Projectile With Explosion #1040
Unanswered
cuppajoeman
asked this question in
Q&A
Replies: 1 comment
-
I think it should work the same in Jolt. Use BodyCreationSettings::mGravityFactor = 0 to turn off gravity for your rocket, use the ContactListener to listen for collisions and use NarrowPhaseQuery::CollideShape with a SphereShape to detect objects that intersect with the explosion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm looking to add projectiles to my game that explode and would apply impulses to nearby objects when that happens.
I will support two different types of projectiles, one is a classic rocket which travels in a straight line and has no gravity applied to it over time, and the other is a grenade which travels in an arc as gravity is applied to it. Let's focus on the classic launcher for now.
In the past when I used a game engine I would have a physics object which had no gravity set on it and I would simply apply an impulse to the rocket to get it moving, the rocket would have it's own collision shape, and it would also have another collision shape which was a sphere for the "blast radius".
When the rocket starts colliding with something I would then check the blast radius to see if there were any objects intersecting that, and for each object apply an outward impulse on that object.
I am going to start implementing this after my exams are over, but in the mean time I was wondering if anyone has successfully implemented this kind of thing in Jolt and if there are any gotcha's/recommendations/differences when doing this in Jolt.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions