77 lines
2.4 KiB
C++
77 lines
2.4 KiB
C++
// Filename: physxDistanceJoint.cxx
|
|
// Created by: enn0x (02Oct09)
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
//
|
|
// PANDA 3D SOFTWARE
|
|
// Copyright (c) Carnegie Mellon University. All rights reserved.
|
|
//
|
|
// All use of this software is subject to the terms of the revised BSD
|
|
// license. You should have received a copy of this license along
|
|
// with this source code in a file named "LICENSE."
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
#include "physxDistanceJoint.h"
|
|
#include "physxDistanceJointDesc.h"
|
|
|
|
TypeHandle PhysxDistanceJoint::_type_handle;
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: PhysxDistanceJoint::link
|
|
// Access: Public
|
|
// Description:
|
|
////////////////////////////////////////////////////////////////////
|
|
void PhysxDistanceJoint::
|
|
link(NxJoint *jointPtr) {
|
|
|
|
_ptr = jointPtr->isDistanceJoint();
|
|
_ptr->userData = this;
|
|
_error_type = ET_ok;
|
|
|
|
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
|
|
scene->_joints.add(this);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function: PhysxDistanceJoint::unlink
|
|
// Access: Public
|
|
// Description:
|
|
////////////////////////////////////////////////////////////////////
|
|
void PhysxDistanceJoint::
|
|
unlink() {
|
|
|
|
_ptr->userData = NULL;
|
|
_error_type = ET_released;
|
|
|
|
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
|
|
scene->_joints.remove(this);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : PhysxDistanceJoint::save_to_desc
|
|
// Access : Published
|
|
// Description : Saves the state of the joint object to a
|
|
// descriptor.
|
|
////////////////////////////////////////////////////////////////////
|
|
void PhysxDistanceJoint::
|
|
save_to_desc(PhysxDistanceJointDesc &jointDesc) const {
|
|
|
|
nassertv(_error_type == ET_ok);
|
|
_ptr->saveToDesc(jointDesc._desc);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : PhysxDistanceJoint::load_from_desc
|
|
// Access : Published
|
|
// Description : Loads the entire state of the joint from a
|
|
// descriptor with a single call.
|
|
////////////////////////////////////////////////////////////////////
|
|
void PhysxDistanceJoint::
|
|
load_from_desc(const PhysxDistanceJointDesc &jointDesc) {
|
|
|
|
nassertv(_error_type == ET_ok);
|
|
_ptr->loadFromDesc(jointDesc._desc);
|
|
}
|
|
|