Game Development Community

SetCollisionTimeout

by Todd Johnson · in Torque Game Engine · 05/27/2004 (8:23 pm) · 1 replies

Has anyone got this to work correctly? From what I understand, this gives an item so much time to where it won't collide with anything.

Currently I have an object that I'm throwing around. Unless I look strait up and throw it, I'll hit my player model. In order to get a good throw, I simply recreate the object, decrease the inventory, and apply impulse to that new object. Unfortunately, my impulses aren't working because the items are being spawned on the player and colliding with him.

I'm trying to stay away from spawning the item a little in front of the player model. Is there something I can set so it doesn't immediately hit the player? Any help is appreciated.

#1
05/29/2004 (8:54 am)
I ran into this same problem trying to toss grenades, they would hit my playermodel and land at my feet :)

either modify the throwObject code or add this to your own:

this first bit finds a location infront of you to throw from

%eye = %obj.getEyeVector();//where obj is you
%vec = vectorScale(%eye, 3);//or however far infront you want it
%final = VectorAdd(%obj.getEyeTransform(),%vec);

this next bit sets up the objects location and velocity

%objtothrow.setTransform(%final);
%vec = vectorScale(%eye,750);//replace 750 with speed you want
%objtothrow.applyImpulse(%final,%vec);

I think that should do it reply if you have any probs