Panda3D
physxController.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxController.I
10  * @author enn0x
11  * @date 2009-09-24
12  */
13 
14 /**
15  *
16  */
17 INLINE PhysxController::
18 PhysxController() : PhysxObject() {
19 
20  _speed = NxVec3(0.0f, 0.0f, 0.0f);
21  _omega = 0.0f;
22  _heading = 0.0f;
23 
24  _jumping = false;
25  _jump_time = 0.0f;
26  _jump_v0 = 0.0f;
27 
28  _sharpness = 1.0f;
29  _min_dist = 0.0001f;
30 
31  _up_vector = NxVec3(0.0f, 1.0f, 0.0f);
32  _up_axis = (NxHeightFieldAxis)physx_up_axis.get_value();
33 
34  switch (_up_axis) {
35  case NX_Z:
36  _up_quat = NxQuat(90.0f, NxVec3(1.0f, 0.0f, 0.0f));
37  break;
38  case NX_Y:
39  _up_quat = NxQuat(0.0f, NxVec3(1.0f, 0.0f, 0.0f));
40  break;
41  default:
42  physx_cat.error() << "only y-up and z-up are permitted" << std::endl;
43  }
44 
45  _up_quat_inv = _up_quat;
46  _up_quat_inv.invert();
47 }
48 
49 /**
50  *
51  */
52 INLINE void PhysxController::
53 ls() const {
54 
55  ls(nout);
56 }
57 
58 /**
59  *
60  */
61 INLINE void PhysxController::
62 ls(std::ostream &out, int indent_level) const {
63 
64  indent(out, indent_level) << get_type().get_name()
65  << " (at 0x" << this << ")";
66 
67  out << " A:0x" << get_actor();
68  out << "\n";
69 }
PhysxActor * get_actor() const
Retrieves the actor which this controller is associated with.
get_name
Returns the name of the type.
Definition: typeHandle.h:136
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20