Panda3D
 All Classes Functions Variables Enumerations
physxD6Joint.cxx
00001 // Filename: physxD6Joint.cxx
00002 // Created by:  enn0x (02Oct09)
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 #include "physxD6Joint.h"
00016 #include "physxD6JointDesc.h"
00017 
00018 TypeHandle PhysxD6Joint::_type_handle;
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: PhysxD6Joint::link
00022 //       Access: Public
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 void PhysxD6Joint::
00026 link(NxJoint *jointPtr) {
00027 
00028   _ptr = jointPtr->isD6Joint();
00029   _ptr->userData = this;
00030   _error_type = ET_ok;
00031 
00032   set_name(jointPtr->getName());
00033 
00034   PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
00035   scene->_joints.add(this);
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: PhysxD6Joint::unlink
00040 //       Access: Public
00041 //  Description: 
00042 ////////////////////////////////////////////////////////////////////
00043 void PhysxD6Joint::
00044 unlink() {
00045 
00046   _ptr->userData = NULL;
00047   _error_type = ET_released;
00048 
00049   PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
00050   scene->_joints.remove(this);
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function : PhysxD6Joint::save_to_desc
00055 //       Access : Published
00056 //  Description : Saves the state of the joint object to a 
00057 //                descriptor.
00058 ////////////////////////////////////////////////////////////////////
00059 void PhysxD6Joint::
00060 save_to_desc(PhysxD6JointDesc &jointDesc) const {
00061 
00062   nassertv(_error_type == ET_ok);
00063   _ptr->saveToDesc(jointDesc._desc);
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function : PhysxD6Joint::load_from_desc
00068 //       Access : Published
00069 //  Description : Loads the entire state of the joint from a 
00070 //                descriptor with a single call.
00071 ////////////////////////////////////////////////////////////////////
00072 void PhysxD6Joint::
00073 load_from_desc(const PhysxD6JointDesc &jointDesc) {
00074 
00075   nassertv(_error_type == ET_ok);
00076   _ptr->loadFromDesc(jointDesc._desc);
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: PhysxD6Joint::set_drive_angular_velocity
00081 //       Access: Published
00082 //  Description:
00083 ////////////////////////////////////////////////////////////////////
00084 void PhysxD6Joint::
00085 set_drive_angular_velocity(const LVector3f &v) {
00086 
00087   nassertv(_error_type == ET_ok);
00088   _ptr->setDriveAngularVelocity(PhysxManager::vec3_to_nxVec3(v));
00089 }
00090 
00091 ////////////////////////////////////////////////////////////////////
00092 //     Function: PhysxD6Joint::set_drive_linear_velocity
00093 //       Access: Published
00094 //  Description:
00095 ////////////////////////////////////////////////////////////////////
00096 void PhysxD6Joint::
00097 set_drive_linear_velocity(const LVector3f &v) {
00098 
00099   nassertv(_error_type == ET_ok);
00100   _ptr->setDriveLinearVelocity(PhysxManager::vec3_to_nxVec3(v));
00101 }
00102 
00103 ////////////////////////////////////////////////////////////////////
00104 //     Function: PhysxD6Joint::set_drive_orientation
00105 //       Access: Published
00106 //  Description:
00107 ////////////////////////////////////////////////////////////////////
00108 void PhysxD6Joint::
00109 set_drive_orientation(const LQuaternionf &quat) {
00110 
00111   nassertv(_error_type == ET_ok);
00112   _ptr->setDriveOrientation(PhysxManager::quat_to_nxQuat(quat));
00113 }
00114 
00115 ////////////////////////////////////////////////////////////////////
00116 //     Function: PhysxD6Joint::set_drive_position
00117 //       Access: Published
00118 //  Description:
00119 ////////////////////////////////////////////////////////////////////
00120 void PhysxD6Joint::
00121 set_drive_position(const LPoint3f &pos) {
00122 
00123   nassertv(_error_type == ET_ok);
00124   _ptr->setDrivePosition(PhysxManager::point3_to_nxVec3(pos));
00125 }
00126 
 All Classes Functions Variables Enumerations