Game Development Community

how do i create a static corpse ?

by Jeff Yaskus · in Torque 3D Beginner · 12/13/2011 (6:13 pm) · 4 replies

After my model dies and goes through death animation... I want permanent static "bodies" left behind.

Is it possible to somehow do this with script ?

like create a static object using the player model -- but locked in the end of the "death" animation?

Are there any existing examples out there I could base it off of?

edit: removing this code leaves the original model behind ...
Armor::onDisabled()
...
   // Schedule corpse removal. Just keeping the place clean.
//   %obj.schedule($CorpseTimeoutValue - 1000, "startFade", 1000, 0, true);
//   %obj.schedule($CorpseTimeoutValue, "delete")
...

But how would I do this if I wanted to say, place a Zombie in death pose - on the ground ?

Spawn it as AI, then kill it ????

I'm sure there is a cleaner way ...

#1
12/14/2011 (7:43 am)
Why not just make a model? Most games use a lower-poly model for static corpses so as to reduce overhead.
#2
12/14/2011 (9:29 am)
I agree with Steve, a separate low-poly model would be the best option if the player isn't going to watch the zombie die.

What you could do is get the source model file, and pose it the same as the end of the death animation and export it as a different model file (eg. zombie-corpse.dts instead of your usual zombie.dts) and place the new static model like you would any other prop around the map.
#3
12/14/2011 (11:56 am)
I've put off learning 3d modeling skills for about 5 years now ... guess i'm going to have to break down and learn Milkshape or something?!

Well, not that I haven't tried ... for countless hours at different times ... but it just doesnt "click" for me, as easily as programming code does ... too many options on all those menus, which I have no idea how to use.

Anyhow -- won't give up hope yet. I'm sure there is a script related solution (isnt there always?!) ...
#4
12/28/2011 (1:18 am)
You could create a separate datablock for your corpse, and in the datablock's onAdd function, kill the object. It's the same as your solution above, but a little bit cleaner since the death will happen automatically.