How to collect nearby RigidBodies/Collidables?

How to collect nearby RigidBodies/Collidables?

Hello again dear community! 

My question is how can I collect other hkpRigidBodies/hkpCollidables close to a specific one? That would mean within a given radius. Is there a demo that I didn't see that covers this or is there a fast answer concerning my problem? 

I hope that I'm not reposting anything but advice would be very much appreciated! 

Thanks in advance.  

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi raibina,

I think using hkpWorld::getPenetrations() or hkpShapePhantom::getPenetrations() with a sphere shape will give the effect you're looking for. These functions returns a list of shapes that are currently overlapping the shape specified.

The Physics\Api\Collide\Queries\ShapeQuery\Penetrations demo uses these function if you want to see an example of them being used. The source file (ShapeQueryDemo.cpp) is quite large as it is 5 demos in one (& a lot of comments explaining the demo) but a search for "penetrations" should find the sections you need. The Collision Queries section in the User Guide might provide some more info on this topic as well.

Amy Developer Support Engineer Havok

Leave a Comment

Please sign in to add a comment. Not a member? Join today