Author Topic: Object Sticking to Player Collision mesh  (Read 306 times)

Is is possible to have an object attach(stick) to the players collision mesh and not alter the playertype?

As in a Sticky Grenade.

If so, I would find it extremely helpful if you posted the code below.

I know a lot of people have asked about this, and from what I've heard, it's not possible. But I have no idea.

I know a lot of people have asked about this, and from what I've heard, it's not possible. But I have no idea.
I see.
That's what I've heard also, but it may be possible none the less.

You're probably better off looking in coding help.

I suppose you could make a mounted image for a "stuck" grenade then attach it to the torso or something with an offset or specialized model so it appears outside the body, but you can't change where it sticks dynamically by doing this (short of creating tons of mounted image datablocks but don't do that). It would also present problems when stuck to scaled players, vehicles, or really anything not using the default player model. It would probably be the easiest solution, however.

Another, hackier, solution would be repositioning an object several times a second with a looping schedule. This would let it stick anywhere on the body, and would be more dynamic in what shapes it could effectively stick to. The drawbacks of this include less efficient code, ugly teleporting effect while moving (which gets worse at higher speeds), and being a total pain to code. It may involve matrix transformations to get rotation right, though that may be my linear algebra class drowning out my knowledge of Torque.