15 #include "bulletGhostNode.h" 16 #include "bulletShape.h" 29 _sync = TransformState::make_identity();
30 _sync_disable =
false;
34 btTransform trans = btTransform::getIdentity();
37 _ghost =
new btPairCachingGhostObject();
38 _ghost->setUserPointer(
this);
39 _ghost->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
40 _ghost->setWorldTransform(trans);
41 _ghost->setInterpolationWorldTransform(trans);
42 _ghost->setCollisionShape(_shape);
50 btCollisionObject *BulletGhostNode::
61 void BulletGhostNode::
64 Parents parents = get_parents();
65 for (
int i=0; i < parents.get_num_parents(); ++i) {
69 if (BulletRigidBodyNode::get_class_type() == type ||
70 BulletSoftBodyNode::get_class_type() == type ||
71 BulletGhostNode::get_class_type() == type ||
72 type.
is_derived_from(BulletBaseCharacterControllerNode::get_class_type())) {
87 void BulletGhostNode::
90 if (_sync_disable)
return;
93 CPT(TransformState) ts = np.get_net_transform();
101 btTransform trans = TransformState_to_btTrans(ts);
102 _ghost->setWorldTransform(trans);
103 _ghost->setInterpolationWorldTransform(trans);
105 if (ts->has_scale()) {
108 for (
int i=0; i<get_num_shapes(); i++) {
110 shape->set_local_scale(scale);
122 void BulletGhostNode::
133 void BulletGhostNode::
139 btTransform trans = _ghost->getWorldTransform();
140 CPT(TransformState) ts = btTrans_to_TransformState(trans, scale);
147 _sync_disable =
true;
149 _sync_disable =
false;
A basic node of the scene graph or data graph.
This is the base class for all three-component vectors and points.
bool almost_equal(const LMatrix4f &other, float threshold) const
Returns true if two matrices are memberwise equal within a specified tolerance.
bool is_derived_from(TypeHandle parent, TypedObject *object=(TypedObject *) NULL) const
Returns true if this type is derived from the indicated type, false otherwise.
bool almost_equal(const LVecBase3f &other, float threshold) const
Returns true if two vectors are memberwise equal within a specified tolerance.
void set_transform(const TransformState *transform, Thread *current_thread=Thread::get_current_thread())
Changes the complete transform object on this node.
static NodePath any_path(PandaNode *node, Thread *current_thread=Thread::get_current_thread())
Returns a new NodePath that represents any arbitrary path from the root to the indicated node...
This is a 4-by-4 transform matrix.
PandaNode * get_parent(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth parent node of this node.
LVecBase3 get_scale() const
Retrieves the scale component of the transform.
TypeHandle is the identifier used to differentiate C++ class types.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...