Game Development Community

Collision not working with RIGID

by baylor wetzel · in Torque Game Builder · 10/19/2006 (4:27 pm) · 7 replies

I accidentally posted this in the 3D forum. Let's try again

Maybe i'm doing something wrong, but in my little TGB pinball game, collisions work fine when the ball's collision mode is set to BOUNCE but not RIGID. If i switch it to RIGID, sometimes the ball collides with the walls and flippers, sometimes it doesn't. i can hit the same flipper or wall and sometimes it stops, sometimes it goes through

Is this a bug in the RIGID setting for collision or is their something special you need to do to make collisions work with RIGID that you don't need to do with BOUNCE?

Other note: i've run this with debug options for both bounding box and collision boundary. Everything looks fine. i've tried remaking the level and trying various different things (making borders visible, replacing multiple borders with just a few bigger ones, removing areas i'd normally let the ball escape into, removing all triggers, colliding with flippers while stationary, increasing the collision zone, cleaning DSOs, etc.)

The pinball is dynamically created, everything else was dropped there from the level editor. Room does not scroll. The only line of code that changes is the collision response. i do not change any other code, parameters or settings in the editor. i have tried this several dozen times so the problem appears to be consistent

-baylor

#1
10/20/2006 (6:28 am)
Hmm on my opinion it's a bug ( but i don't quite sure )
i download the new version tgb 1.1.1
and it doesn't have RIGID collision
it just only has
clamp,bounce , sticky , kill,
i think you should download the new version of tgb
#2
10/20/2006 (6:33 am)
The new version is 1.1.2 and RIGID was removed because it is hard to setup and people would flood the forums with questions. You shouldn't touch RIGID unless you know what you are doing. You can still use it from script.
#3
10/20/2006 (7:42 am)
Yes, RIGID is still an option, it's just a hidden one. It took me a while to figure out that it had not been removed, only hidden. Our school teaches TGB and the disappearance of previous functionality (or apprearance of functionality) threw off our lesson plans and invalidated the tutorials and assignments we had created for our students. Perhaps when more complete documentation is created the option will be put back

In my particular case, the issue isn't about rigid physics as i'm not worried about how the ball moves right now. My issue is that collision doesn't work when collision mode is rigid. Either there is a bug, which i'd like to confirm, or collision detection needs to be configured differently when used with the rigid response mode. Or maybe my simple test project just has some incredibly wierd and hard to find bug in it that is unique to me
#4
10/23/2006 (5:48 pm)
I've been using RIGID just fine with every version. I'm also using custom collision polygons. I don't know if it reacts different if you just use a collision circle or what have you.
#5
10/23/2006 (8:37 pm)
If you have the source and you wanna add it back into the level editor go into TGB\tools\levelEditor\scripts\forms\quickEditClasses\t2dSceneObject.ed.cs
line 202:
////added \tRIGID here
  %collisionRollout.createDropDownList("collisionResponse", "Collision Response", "", "CLAMP\tBOUNCE\tSTICKY\tKILL\tRIGID", "Change the collision response mode.");
Bada bing...now it's back in the dropdown menu (although I don't know if it actually will set it, I haven't tried..)
#6
10/24/2006 (10:43 am)
We might have an answer. The game in question is pinball. The ball moves pretty fast and hits lots of obstacles. Sometimes collision is handled properly, sometimes the ball goes halfway through before the collision is handled, sometimes the ball goes right through and the collision isn't registered

i had several people here look at it and the theory (as yet unproven) is that rigid physics does not run fast enough to keep up with the action on the screen. Bounce and other modes, which presumably are faster to calculate, work fine. Because the problem is sporadic and because the ball sometimes goes halfway through an object before the collision is detected and handled (we have collision boxes enabled so we can see where it should have collided), our best guess is a timing issue. We've shown this behavior on several test programs. Not sure how to confirm that it's a timing/performance issue though

This was an assignment for a class we teach and is the first time we've tried pinball. Other, simpler games such as asteroids worked fine with rigid physics. For now, we're going to drop rigid physics for this quarter and, i'm guessing, just not assign a pinball game in future quarters, at least until we find that rigid physics will work for this type of game

-baylor
#7
10/24/2006 (10:48 am)
I think it's an excellent lesson to be teaching, but in my personal opinion I'd be teaching the concept of custom physics instead of rigid physics (assuming your school has source code licenses)--ball physics are a highly optimized version of rigid body dynamics, and I'm betting you are absolutely right in that you are getting ahead of the simulation in some cases if you are moving -really- fast.

However, the pinball concept really would be a great theory/design example when it comes to implementing physics, and would also help your students learn how to go beyond an engine by implementing customizations for their design goals...something that honestly not many schools teach, but something that is critical to understand in game development--no engine is ever going to do every single thing you want, and there is always custom implementation going to be needed somewhere.