Filtering character proxy collisions

Filtering character proxy collisions

Portrait de zidanqiu

Hello all. I'd like my character proxy to be able to pass through rigid bodies of a certain filter number. The demos demonstrate that rigid bodies can be set to ignore each others' collisions, but there seems to be no such option for character proxies.

In case I'm approaching this the wrong way altogether (very likely), I'm trying to give an object a collision that I can shoot a raycast towards so that the player can detect a usable object; I want the object to have a physical presence, but not for the player to physically bump into/traverse the object. Thanks a ton in advance, and let me know if I need to clear anything up. =]

4 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.
Portrait de admin

Hi, you should be able to set the filter on the phantom tied to the proxy. In that case, you will also have to call "updateCollisionFilterOnPhantom" to make sure the collision filter gets updated. -Vincent

Portrait de Paul M.

I see I can set the filter for a phantom when I initialize it. However, there doesn't seem to be any functionality to change it dynamically (similar to hkpRigidBody::setCollisionFilterInfo). Is this true or am I missing something? Or is there another way to dynamically change the collision filter of a phantom?

Portrait de havok_David

Hey Paul,

Filters attached to hkpPhantoms are implemented differently than for hkpRigidBodies because such a collision would not affect the colliding entity (ie.: Collision with Phantoms do not need to be resolved). Here are three methods that can be used to dynamically change the collision filter of a phantom:

Method 1: Inherit from hkpCachingPhantom or hkpAabbPhantom and implement hkpPhantom::addOverlappingCollidable/hkpPhantom::removeOverlappingCollidable according to your dynamic filter (eg.: Demo\Demos\Physics\Api\Dynamics\Phantoms\PhantomObject\PhantomObjectDemo.cpp\PhantomObjectDemo)

Method 2: Change your hkpPhantom's m_collidable itself through hkpPhantom::getCollidableRw() but if you do that, don't forget to set your own collision filter(by inheriting from hkpCollisionFilter as shown in Demo\Demos\Physics\Api\Collide\CollisionFiltering\UserCollisionFilter\UserCollisionFilterDemo using hkpWorld::setCollisionFilter to make Havok use your custom Filter) and call hkpWorld::updateCollisionFilterOnPhantom to update the actual collisions.

Method 3: Wrap your phantom into an hkpEntity using an hkpPhantomCallbackShape (eg.: see Demo\Demos\Physics\Api\Dynamics\Phantoms\PhantomEvents\PhantomEventsDemo). You could then use hkpRigidBody::setCollisionFilterInfo as usual to dynamically change your filter.

Let me know if you're getting any other issues,
Cheers,

David.

David G. Developer Support Engineer Havok www.havok.com

Connectez-vous pour laisser un commentaire.