mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
bullet: Implement make_copy() for BulletGhostNode
This commit is contained in:
parent
cc4701d299
commit
642f4a4e55
@ -41,6 +41,39 @@ BulletGhostNode(const char *name) : BulletBodyNode(name) {
|
|||||||
_ghost->setCollisionShape(_shape);
|
_ghost->setCollisionShape(_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not call the copy constructor directly; instead, use make_copy() or
|
||||||
|
* copy_subgraph() to make a copy of a node.
|
||||||
|
*/
|
||||||
|
BulletGhostNode::
|
||||||
|
BulletGhostNode(const BulletGhostNode ©) :
|
||||||
|
BulletBodyNode(copy),
|
||||||
|
_sync(TransformState::make_identity()),
|
||||||
|
_sync_disable(false),
|
||||||
|
_sync_local(false)
|
||||||
|
{
|
||||||
|
// Initial transform - the node has no parent yet, so this is the local one
|
||||||
|
btTransform trans = TransformState_to_btTrans(get_transform());
|
||||||
|
|
||||||
|
// Ghost object
|
||||||
|
_ghost = new btPairCachingGhostObject();
|
||||||
|
_ghost->setUserPointer(this);
|
||||||
|
_ghost->setCollisionFlags(btCollisionObject::CF_NO_CONTACT_RESPONSE);
|
||||||
|
_ghost->setWorldTransform(trans);
|
||||||
|
_ghost->setInterpolationWorldTransform(trans);
|
||||||
|
_ghost->setCollisionShape(_shape);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a newly-allocated PandaNode that is a shallow copy of this one. It
|
||||||
|
* will be a different pointer, but its internal data may or may not be shared
|
||||||
|
* with that of the original PandaNode. No children will be copied.
|
||||||
|
*/
|
||||||
|
PandaNode *BulletGhostNode::
|
||||||
|
make_copy() const {
|
||||||
|
return new BulletGhostNode(*this);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -61,8 +61,10 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static void register_with_read_factory();
|
static void register_with_read_factory();
|
||||||
|
virtual PandaNode *make_copy() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
BulletGhostNode(const BulletGhostNode ©);
|
||||||
static TypedWritable *make_from_bam(const FactoryParams ¶ms);
|
static TypedWritable *make_from_bam(const FactoryParams ¶ms);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user