- Home /
Complex Object Out of Control Collisions
Hello, I've been having an issue for several days and I was wondering if someone could shed a light on it. I have a small modular robot (see bellow) that has 3 wheels and 4 joints. These robots can be linked together to form larger configurations like the quad shown below. However after some simulation it appears that the quad jumps up into the air and spins uncontrollably. I assume that this is due to some of the collisions from the components, but I don't know what I can do about it. My fixed timestep is set to 0.001 and my solver iteration count is set to 20. Any help is greatly appreciated!
Answer by AlwaysSunny · May 11, 2015 at 09:54 PM
Obviously there are some best-practices you must follow, but from the looks of this, you're aware of these already.
A respectable gap between colliders is a must in tight-quarters high-scrutiny situations like this. Also, you should separate all qualifying objects into non-interactive layers, so you have the most streamlined matrix of inter-active objects possible. I'm not really sure that applies in your situation from looking, since all their activity is inter-related.
Think it out, though; could any objects belong to layers which don't raise collision events with each other? Depending on how all this works, for instance, perhaps wheels never collide with other wheels, bodies with other bodies, etc. That may or may not address the problem about which you're posting, however.
Apart from that, I think it's a valid statement to claim Unity's PhysX system is designed for games first. Simulations such as this may not be entirely feasible. I estimate a truly incredible number of per-frame physics calculations necessary to drive this compound object. I'm really surprised it works at all; PhysX is impressive.
I have removed collisions from components inside the same module, but it is possible that the gap between the two inner sections is a bit tight. Also would you happen to have any idea as to a possible approach to avoiding using mesh colliders for the wheels? Or should I make a new post for that?
Squished capsule would be better. Less accurate with regard to the rounded corners, but most likely superior in every other way. You might consider using a wheel collider, but obviously that has limitations with regard to interacting with other objects. A combination between the two (wheels for wheel action, squished capsule for gross physical interaction) might work best, but is potentially twice as expensive.