OFPEC Forum
Addons & Mods Depot => Arma2 - Configs & Scripting => Topic started by: DMarkwick on 11 Feb 2010, 08:49:45
-
You might say, how do I find the dead-center haha :D
Anyway.
When a unit dies, it very much seems to depend on what stance the unit is in when he's killed as to the location of the boundingCenter returned value. Example:
Shoot a unit who's standing up, and even after he's fallen down dead, returning the center of the unit's position still returns a location located over his feet.
However, shoot a unit who's prone and the same center location is the actual center of his laying-down body.
I've used delays etc and various combinations of boundingCenter and modelToWorld etc, but I always get a unit's feet position when looking for a body's center position if that unit was standing when he was killed.
Anyone know what I might try next?
-
try mandos script from arma1 , it will return the position in every stance , not sure if he converted it to A2 but it shouldnt need much.
failing that do an array of anims and get the likely center( bit long winded).
bounding arrays always return the array of a unit /vehicle/structure at the moment its created , not a live update.
infact having thought about it , selectionposition maybe your friend.
if the spine memmory point or similar is updated with the rtm . it would look something like :
pos = unit selectionposition "spine" iirc
then you would get realpos = (unit modeltoworld pos) .
away from home at the min so not 100% on my syntax
-
Thankfully in A2 selectionPosition finally fully works, even with the dead :good:
-
I don't seem to be having much luck with selectionPosition either. "spine" doesn't seem to exist (in that I don't see results) while "hit_body" has the same result as before i.e. feet position.
-
Try "Pelvis".
At least that has worked for me in the past..
That spine selections is probably "Spine3" and consists of one vertex and a proxy so that might not give the position you're looking for.
-
well i was not at my home pc when i wrote it but "Pelvis" is probably better.
Remember at the exact moment of death the location of the center will be exactly same , it is not until the death animation is finished and the soldier is lying that you then need to get your Data .
in essence if your returning the info at the moment of death then it wont be the most update position.
edit seems -H already pointed out the Pelvis selection.
-
I'll try the pelvis selection thing. I also did consider the positional info at time of death, and experimented with delays to let the new pose become valid, but no luck yet. Fingers crossed with the pelvis. (One of those once-in-a-lifetime sentences for sure ;))
-
Pelvis works , i know that from previous tests of my own .
As to your problem returning the exact position of the body center after death , the simple solution (if you cant delay the data return till after the rtm) is to make a small addon and use attachto and use the Init of the small addon to then give you a pos ,
If your using this for a drop effect or something then i know myself it works as i have used it for something myself.
you could do a generic Killed eventhandler jtdcenter attachto [deadunit,[0,0,0]","Pelvis"] ;
-
It seems that pelvis does indeed work :)
Needed it for the JTD_Flies addon BTW, the flies were always rather annoyingly centered around the feet area.
Thanks to all :)
-
the flies were always rather annoyingly centered around the feet area
:D Well you know how it is after days and days out in the boons in those army boots...
Wolfrug out.
-
Well you know how it is after days and days out in the boons in those army boots...
Well now that the flies are centered around the pelvis area we can lay the hygiene thing down to rest.
Can't we? ;)