? about multiple explosions
by Michael Cozzolino · in General Discussion · 06/11/2002 (11:27 am) · 4 replies
I am trying to have a seperate explosion go off if my projectile hits a player. ie. Blood explosion instead of the default explosion I created for the projectile.
Does anyone have an idea on how to do this or is currently tring to do the same thing?
Thanks
Coz
Does anyone have an idea on how to do this or is currently tring to do the same thing?
Thanks
Coz
About the author
Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489
#2
You could even add blood decals to the terrain where the player was hit :)
06/11/2002 (7:33 pm)
Why not just add a new blood emitter to the player? Then add a new method, Player::emitBlood(Point3F point), and make the emitter emit particles much the same way the the foot puff emitter does. You could either make a console function for it and call it up via the scripted Player::onDamage (can't remember if it has position as a parameter though) or through Particle::onCollision in the engine.You could even add blood decals to the terrain where the player was hit :)
#3
06/21/2002 (8:20 pm)
Robert could you clarify what you mean by add my explosion to the scene?
#4
06/25/2002 (11:56 am)
Well I figured this out and submitted it as a resource. Once it is approved I will put the link up here for anyone who stumbles upon this thread.
Torque 3D Owner Robert Blanchet Jr.
1. When the projectile processes the onCollission you
need to detect whether the projectile has hit a player
object.
2. If the projectile is hitting a player object then get the last known position of the projectile.
3) Add an explosion object (your blood explosion) to the scene.
That would be your logic.
In the above I choose to find the last known position of the projectile because I could then inaccurately simulate where the player got hit. But if you didn't want to do this then you would just find the position of the player object instead.
By finding the position I mean finding its world box center via %obj.getWorldBoxCenter(). Or you could just simply do %explosionObject.setTransform(%playerObject.getTransform());