Collision bug with vehicles!
by Dr. John Nobody · in Torque Game Engine · 08/08/2003 (8:45 am) · 2 replies
It seems that there are serious bugs with torque's vehicles collision detection, bad enough to make them unusable. First off, I've only messed with flying and wheeled vehicles, so I dont know how hover vehicles are affected, but I suspect the same. I've noticed that vehicles simply do not colide with dts shapes in any way, its like they dont exist, as for terrain, if you colide with it at a near parralell angel then you sometimes bounce off, however the more perpendicular you get, the greater chance you have of just punching right through the terrain. This isnt so much an issue for wheeled vehicles but its a huge problem for flyers. (note: this is a bug, not just me making bad models, I tried using torque's default buggy as both wheeled and flying vehicles and it still had this problem)
#2
Also, are you sure colission works for static shapes? I wasnt just getting funky collision with them, I was getting no collission, not even a hint of it :(
08/08/2003 (10:24 am)
Wow Brad, thats a lot of great info! afraid some of it was slightly over my head though. You said I can affect stuff by tweaking the values for bodyRestitution and bodyfriction, would you mind explaining how these variables fit into the big picture (I tried looking through the code, was a little confused). I'm assuming body friction is... well, bodyfriction, could you explain how high or low body fricitons effect collision? and what bodyrestitution is? Just not sure how to tweak things to get my desired effect.Also, are you sure colission works for static shapes? I wasnt just getting funky collision with them, I was getting no collission, not even a hint of it :(
Torque Owner Brad Shapcott
Read the later posts in that thread.
After spending a long time looking at the vehicle code, I'd say that you cannot expect an arbitrary vehicle to work without tuning its parameters. Excessive acceleration and velocity will cause problems, the former because the vehicle can accelerate past its projected collision, the latter because it makes the projection unreasonably large. Reduce the forces being applied to the vehicle. Make sure that the DTS shapes have collision hulls of their own. Friction is finicky. The rigid body collision resolution is based on Baraff, and Baraff admits that his algorithm can be exponential, though it is generally linear. But Baraff doesn't integrate friction in the iteration step, the addition of which from my observations destabilizes Baraff's algorithm (and I haven't been able to find any reference supporting this technique). Baraff's algorithm is otherwise well known and has been reviewed and critiqued by many others, so that it's idiosyncracies are well known. It is a popular algorithm because it doesn't require solving linear or quadratic systems of equations. And Baraff's algorithm is correctly implemented in Torque (I did compare them in detail; Torque and Baraff modularize code differently, but the algorithm is the same).
The game I'm making needs simpler collision physics, so I rewrote the vehicle collision code to simplify it. If I was trying to fix up the existing vehicle collision algorithm, I'd look at moving friction calculations outside of the iteration step.