Jump to content
Sign in to follow this  
Tankbuster

Position of newly killed man/animal?

Recommended Posts

I hoped this would be easy, but it's turned out not. :)

I hide some of my IEDs under dead bodies of animals or men. I spawn the man at a known position, kill him with setdamage then place the IED in the same position. But the IED is always at the guys feet.

I want to hide the IED more under his torso. I've got his position and heading before and after death and they are exactly the same. His pos doesn't change as he dies. I've looked at nearestObjects to see if he changes to a different model when he dies, but he doesn't.

Anyone have any thoughts?

Share this post


Link to post
Share on other sites

Have you tried attaching it to body part

ied attachto [man,[0,0,0],"Pelvis"];

Share this post


Link to post
Share on other sites

Aha! No, I hadn't thought of that. :)

Share this post


Link to post
Share on other sites

I don't think collision checking is the issue. The thing is that the position is most likely outgoing from the feet, regardless if the guy's laying down or not, so it spawns at the feet.

Share this post


Link to post
Share on other sites
I guess you are using createVehicle instead of createVehicle_array - use the latter one, its MUCH more quicker and you can disable collision checking, which is your problem it seems :D

Neither. As I'm spawning animals and men, I'm using createAgent. If you useeither createVehicle command to create animals, they are sunk into the ground.

---------- Post added at 10:20 ---------- Previous post was at 10:19 ----------

I don't think collision checking is the issue. The thing is that the position is most likely outgoing from the feet, regardless if the guy's laying down or not, so it spawns at the feet.

I'm thinking this might be right. I'm going to try a few tricks to rig this so it looks better.

---------- Post added at 10:55 ---------- Previous post was at 10:20 ----------

Trick #1 failed. I thought I'd setdir the guys after he died to 180, then move him south a meter, but it wasn't quite that simple. His direction is the way his head is facing so his direction depends more on his death pose than the alignment of his body.

---------- Post added at 11:13 ---------- Previous post was at 10:55 ----------

Have you tried attaching it to body part

ied attachto [man,[0,0,0],"Pelvis"];

I have tried it now, good thinking, thanks for it. It looks good especially if I offset the Z by -10 cm, but it brings other problems. Not all of the models have an appropriate body part to use. The animals don't. Also, using attachto means the eventhandlers on the IED don't work any more which is crucial to the system.

Share this post


Link to post
Share on other sites

Can't help with animals but if they do attach to them if you can get the direction then in may be possible to just offset it.

Once you have used the attachto you can then detach it and that should enable the EVH's again.

detachvehicle ied

Share this post


Link to post
Share on other sites

Tanky, how about modelToWorld, with an offset which works for both the animals, and men you are using? I guess that depends on how large of an animal you wanted...

Initial test on man, this seems to work ok:

ied setPos (body modelToWorld [-.85,-1,0]);

of course, change z value to bury it a bit

After more testing, maybe best to use F2k Sel's method, and use "Head", with offset. All animals have a "head" selection.

Or, how about boundingCenter?

Edited by panther42

Share this post


Link to post
Share on other sites

The problem with modeltoworld is chiefly that I can't get my head around it. lol. Bounding box, on the other hand is quite simple to use and is in fact giving expected results. Early tests show that I can use the 2 Z ouputs to get the extremes of the body of the dead chap, work out where the middle is... job done.

I often get all carried away when a solution presents itself. But we live in the murky world of BI where disappointment is our life partner and frustration is our sustenance. So I won't get too excited thinking we've solved it until I can prove my theories when I get home this evening. :)

---------- Post added at 16:03 ---------- Previous post was at 16:02 ----------

Ah, OK, Panther, you edited while I was posting. It looks more simple now you've done the hard work for me! lol.

Share this post


Link to post
Share on other sites

Well, I tested several different methods, using modelToWorld (selectionPosition "head_hit"), and modelToWorld (selectionPosition "body_hit"), just puts the ied at the soldiers feet, or near each animal...

Trying boundingCenter doesn't offer much help either, as modelToWorld (boundingCenter obj) just puts the ied on the ground next to it. I was trying to stay away from attachTo, as you stated this disables your event handlers...

I guess if these are acceptable, you could bury the ied a bit, and depending on your trigger radius for explosion, would do the trick. Otherwise, the attachTo "Head", with offset seems to be the best alternative, if it then works to detachVehicle as F2k stated.

Share this post


Link to post
Share on other sites

Right, here's the problem. In each case, the IED is spawned at exactly the same pos as the dead animal.

BOv8TL9.jpg

dnBDIB0.jpg

CvzXqid.jpg

You can see the problem. Note that with the dog and the cow, it's between the feet, yet with the sheep, it's in it's arse. :)

And so, with individually crated offsets using modeltoworld, I get these;

nD6uY2z.jpg

dDjv3GV.jpg

WkmnUGH.jpg

So that's fine. Each animal has a different offset, which is a bind, but I've worked them out.

The bummer is that it doesn't work for dead humans. For reasons unknown, the ied can't be made to spawn reliably in the same place relative to the body. I think it might be to do with the randomness of the death pose.

Anyway, thanks to everyone here, I've more or less sorted it.

Share this post


Link to post
Share on other sites

Just a question here: If you want to completely hide the IED into the dead bodies, can't you just hide the IED itself? Like using hideObject and showing it when some conditions are met?

Or do you want that the IED should show a little so the player can discern if the body is safe or not?

Share this post


Link to post
Share on other sites

I hide the IED to various extents by sinking it into the ground. In the pics above it's 20cms sunk. If I use hideobject, the eventhandlers stop working.

I do like to give the players a small chance of a visual id of the device. I'm going to add a little randomness to the offset seen above so that there's a chance it will be completely hidden by the larger animals such as the cow.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×