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