Added utility function BulletWorld::test_filter
This commit is contained in:
parent
04bbf28a71
commit
259d2df0c4
|
|
@ -715,10 +715,46 @@ sweep_test_closest(BulletShape *shape, const TransformState &from_ts, const Tran
|
|||
return cb;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletWorld::filter_test
|
||||
// Access: Published
|
||||
// Description: Performs a test if two bodies should collide or
|
||||
// not, based on the collision filter setting.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool BulletWorld::
|
||||
filter_test(PandaNode *node0, PandaNode *node1) const {
|
||||
|
||||
nassertr(node0, false);
|
||||
nassertr(node1, false);
|
||||
nassertr(_filter_cb, false);
|
||||
|
||||
btCollisionObject *obj0 = get_collision_object(node0);
|
||||
btCollisionObject *obj1 = get_collision_object(node1);
|
||||
|
||||
nassertr(obj0, false);
|
||||
nassertr(obj1, false);
|
||||
|
||||
btBroadphaseProxy *proxy0 = obj0->getBroadphaseHandle();
|
||||
btBroadphaseProxy *proxy1 = obj1->getBroadphaseHandle();
|
||||
|
||||
nassertr(proxy0, false);
|
||||
nassertr(proxy1, false);
|
||||
|
||||
return _filter_cb->needBroadphaseCollision(proxy0, proxy1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletWorld::contact_test
|
||||
// Access: Published
|
||||
// Description:
|
||||
// Description: Performas a test for all bodies which are
|
||||
// currently in contact with the given body.
|
||||
// The test returns a BulletContactResult object
|
||||
// which may contain zero, one or more contacts.
|
||||
//
|
||||
// If the optional parameter use_filter is set to
|
||||
// TRUE this test will consider filter settings.
|
||||
// Otherwise all objects in contact are reported,
|
||||
// no matter if they would collide or not.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BulletContactResult BulletWorld::
|
||||
contact_test(PandaNode *node, bool use_filter) const {
|
||||
|
|
@ -742,7 +778,10 @@ contact_test(PandaNode *node, bool use_filter) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletWorld::contact_pair_test
|
||||
// Access: Published
|
||||
// Description:
|
||||
// Description: Performas a test if the two bodies given as
|
||||
// parameters are in contact or not.
|
||||
// The test returns a BulletContactResult object
|
||||
// which may contain zero or one contacts.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BulletContactResult BulletWorld::
|
||||
contact_test_pair(PandaNode *node0, PandaNode *node1) const {
|
||||
|
|
@ -815,7 +854,7 @@ set_group_collision_flag(unsigned int group1, unsigned int group2, bool enable)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletWorld::get_collision_object
|
||||
// Function: BulletWorld::get_group_collision_flag
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ PUBLISHED:
|
|||
BulletContactResult contact_test(PandaNode *node, bool use_filter=false) const;
|
||||
BulletContactResult contact_test_pair(PandaNode *node0, PandaNode *node1) const;
|
||||
|
||||
bool filter_test(PandaNode *node0, PandaNode *node1) const;
|
||||
|
||||
// Manifolds
|
||||
INLINE int get_num_manifolds() const;
|
||||
BulletPersistentManifold *get_manifold(int idx) const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue