Panda3D
|
00001 // Filename: physxController.I 00002 // Created by: enn0x (24Sep09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 00017 //////////////////////////////////////////////////////////////////// 00018 // Function: PhysxController::Constructor 00019 // Access: Protected 00020 // Description: 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE PhysxController:: 00023 PhysxController() : PhysxObject() { 00024 00025 _speed = NxVec3(0.0f, 0.0f, 0.0f); 00026 _omega = 0.0f; 00027 _heading = 0.0f; 00028 00029 _jumping = false; 00030 _jump_time = 0.0f; 00031 _jump_v0 = 0.0f; 00032 00033 _sharpness = 1.0f; 00034 _min_dist = 0.0001f; 00035 00036 _up_vector = NxVec3(0.0f, 1.0f, 0.0f); 00037 _up_axis = (NxHeightFieldAxis)physx_up_axis.get_value(); 00038 00039 switch (_up_axis) { 00040 case NX_Z: 00041 _up_quat = NxQuat(90.0f, NxVec3(1.0f, 0.0f, 0.0f)); 00042 break; 00043 case NX_Y: 00044 _up_quat = NxQuat(0.0f, NxVec3(1.0f, 0.0f, 0.0f)); 00045 break; 00046 default: 00047 physx_cat.error() << "only y-up and z-up are permitted" << endl; 00048 } 00049 00050 _up_quat_inv = _up_quat; 00051 _up_quat_inv.invert(); 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: PhysxController::ls 00056 // Access: Published 00057 // Description: 00058 //////////////////////////////////////////////////////////////////// 00059 INLINE void PhysxController:: 00060 ls() const { 00061 00062 ls(nout); 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: PhysxController::ls 00067 // Access: Published 00068 // Description: 00069 //////////////////////////////////////////////////////////////////// 00070 INLINE void PhysxController:: 00071 ls(ostream &out, int indent_level) const { 00072 00073 indent(out, indent_level) << get_type().get_name() 00074 << " (at 0x" << this << ")"; 00075 00076 out << " A:0x" << get_actor(); 00077 out << "\n"; 00078 } 00079