Game Development Community

Collision problem

by University of Gotland (#0006) · in Torque Game Builder · 05/09/2008 (1:15 pm) · 3 replies

Have a problem when my object hits a collision wall, if I keep going in to the wall the object pushes in to the collision object and keeps jumping back and forth.

I use a mouse to steer, get same problem if i go real fast in to a wall with keyboard.

How can I fix this?

#1
05/09/2008 (2:48 pm)
Did you edit the onCollision function at all?
#2
05/10/2008 (12:41 am)
Nope, tried to use clamp and sticky on the walls, but that didn't work so I changed it back.
#3
07/18/2008 (3:36 pm)
It sounds like you're setting position or using linearVelocity, which impulses out upon collision. A large problem the ColDet in TGB has is that it's not high resolution clock, nor does it PREVENT collisions, they're just slight.

Try using setConstantForceX/Y()
and also custom management of what do to once we're in collision.
Remember, collision detection is made to prevent overlap, this is not the case. The time between when the callback is sent to you and the updates on your character position allow him to slide slightly into your colliding objects.

castCollisions() too. This is useful if you're going FAST and you want to get a volume approach to collisions to determine if your object may have skipped through something. Effectively this creates a line from point a to point b, where a is your start and b is your finish. It then checks intervals of point containment using a simple algorithm I imagine.

Good luck, been struggling with collisions for awhile now.