Game Development Community

How to send physics to some objects but not others

by Cosmic Logic · in Torque Game Builder · 03/30/2009 (11:59 pm) · 2 replies

I want to send a physics collision to some objects but not others.

I tried disabling certain collision layers, but I still need to process collisions with that type of object, I just don't want them to bounce off of them(which is the collision setting I'm using).

Ex:
Object X needs to collide normally and physically with object Y, it also needs to collide normally with object Z, but X cannot physically collide with Z. X needs to pass over top of Z

Can this be done in TGB/script or is this a change at source code level?

#1
04/02/2009 (9:21 am)
I am not sure if I am reading you right, but I think triggers might help you with your problem. If you want to process a collision without bouncing off of it.. attach a trigger to your object and use the "onEnter" method of the trigger to detect the collision, and run your code. I haven't found another way to detect a collision without the object responding to it.

If the triggers don't work, your next option might be to keep a log of the physics of whatever object(s) you want to NOT bounce off, and then after the collision, set it up to reset the physics back to the way it was an instant before.. then you would get a seamless non-bouncy effect to the collision.. go with the triggers first though.
-nic
#2
04/03/2009 (9:33 pm)
That sounds great. I'll give it a try.

In the mean time I found a work around. The implementation is a lacrosse player throwing a ball.

If the target is on the other side of him the ball bounces while going over him. I just made a series of link points around him, determined the direction of the target and mounted the ball on the appropriate link point then passed :P

Thanks for the help though, your way is definately more efficient :)