EmbarkStudios / physx-rs

🎳 Rust binding for NVIDIA PhysX 🦀
http://embark.rs
Apache License 2.0
656 stars 42 forks source link

How can i remove a Rigid Dynamic actor from scene when it collide with a specific object ? #214

Open JitendraDogra opened 1 year ago

JitendraDogra commented 1 year ago

Currently i am trying to remove an object from scene when it collide with a specific object does anybody know proper way to achieve this scenario.

rlidwka commented 1 year ago

First you detect the collision using onCollision hook (don't forget scene filters). Then you get actor pointer from collision callback, verify that it's valid (flags), and remove it (scene.removeActor is a thing, but you can just drop the actor, and it'll remove itself the scene on cleanup).

This is pretty long list of things to do, is there any particular part you have trouble with?

JitendraDogra commented 1 year ago

Actually i tried to remove actor on collision but got some error right now i am away from my work machine i will post source and error. Thanks @rlidwka.