Rigidbodies, set solid/non collision?

Rigidbodies, set solid/non collision?

Heya!

I'm new to Havok but I'm struggling to find out how to TURN OFF collision on a rigidbody. I've looked into collisionFiltesr but not sure how to work them out.

Any ideas?

Thanks in advance!

3 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Alright so I've done the following code BEFORE I start adding rigidbodies to the world:

hkpGroupFilter* filter = new hkpGroupFilter();
filter->disableCollisionsBetween(1, 1);
m_physWrapper->getWorld()->setCollisionFilter(filter);
filter->removeReference();

After that I use m_PhysObj->GetRigidBody()->setCollisionFilterInfo(1);

m_PhysObj is a class that handles our PhysicsObject, it basically wraps Havok functionality. If I've understood this correctly the ridigbody now should classify as being a part of "Layer 1"?

But two objects in the same layer still collides with eachother which seems odd since I disable collision for Layer/Group 1.

Any help would be appreciated.

You say you set the collision filter on the world before adding bodies, but are you setting the collision filter info on the body before or after you add it to the world?

You want to set the collision filter info on the body before it gets added to the world. Otherwise the body might pick up collisions (which are then cached internally) before the filter is set. You can easily do this by setting m_collisionFilterInfo on the hkpRigidBodyCInfo that you use to create the body, or by making sure setCollisionFilterInfo() is called before adding the body to the world. If you do need to change the filter after a body has been added to the world you need to inform the world via:

world->updateCollisionFilterOnEntity( entity, HK_UPDATE_FILTER_ON_ENTITY_FULL_CHECK, HK_UPDATE_COLLECTION_FILTER_PROCESS_SHAPE_COLLECTIONS );

Otherwise what you've got sounds right.

Let me know if this helps or if you'r still having trouble.
-Tyler

Connectez-vous pour laisser un commentaire.