Sprites not staying within collision blocks
by Michael Balogh · in Torque Game Builder · 01/07/2008 (5:25 pm) · 3 replies
Hey everyone!
For my game, I have some sprites I need to be contained inside of a square. So, I have the square sprite with no collision detection on it basically as a background. And then, to make the objects to stay within the square, I put four boxes (with collision detection) around each side of the square and mounted them.
This works well when I have one or two objects bouncing around inside of the square. But when about 3 or more objects are in the 4 bounding boxes, they begin to go through the bounding boxes. The bounding boxes have Send/Receive Collision and Physics checked and are FULL Collision.
The objects bouncing around have Send/Receive Collision on, but not the Physics.
Any ideas on why they get past the collision on the square?
For my game, I have some sprites I need to be contained inside of a square. So, I have the square sprite with no collision detection on it basically as a background. And then, to make the objects to stay within the square, I put four boxes (with collision detection) around each side of the square and mounted them.
This works well when I have one or two objects bouncing around inside of the square. But when about 3 or more objects are in the 4 bounding boxes, they begin to go through the bounding boxes. The bounding boxes have Send/Receive Collision and Physics checked and are FULL Collision.
The objects bouncing around have Send/Receive Collision on, but not the Physics.
Any ideas on why they get past the collision on the square?
About the author
#2
01/08/2008 (1:21 am)
I just remembered how I did: do %yourobject.setCollisionMaxIterations(3), and it will process 3 collisions in a single frame for %yourobject.
#3
@Benjamin: That function looks familiar...I remember seeing it a long time ago, but I forgot about it. Thanks a lot for the reminder! I'll test it and see what happens.
Thanks for your help guys!
01/08/2008 (8:02 pm)
@Phillip: That works great! I set the World Limit and it keeps them all in there, all the time. Thanks so much for your help!@Benjamin: That function looks familiar...I remember seeing it a long time ago, but I forgot about it. Thanks a lot for the reminder! I'll test it and see what happens.
Thanks for your help guys!
Associate Phillip O'Shea
Violent Tulip
TGB sports a "World Limit" system whereby an object has boundaries and resolutions defined. So, I suggest that you look into the world limit system to resolve your issue. It sounds as if it would be a much better solution to your current setup.