- Home /
[C#] Wheelcolliders issues in 5.0, collision
Here is the script, it works like a gear subtractor, there is a maximum difference of RPM in the two sides, which is controlled by the steering axis. Worked flawlessly in 4.2, and I'm not actually sure anything is wrong with the script itself, because the wheel rotate in the proper direction and everything, but the wheelcolliders do some weird things. The circle that represents the wheel isn't aligned with the line showing the suspension axis, and I'm not sure how to get them to align, turning a parent of the parent, rotates it in an odd fashion, but rotating the parent or the object itself doesn't. In addition the wheels won't collide with anything, and I can't for the life of me figure out why.
This is how it looks normally. 
If I rotate the object with the collider: 
If I rotate the parent object: 
If I rotate the parent's parent I can get them to line up, but no amount of finagling after that can get them pointed down and aligned. 
$$anonymous$$mmkay. So, if any object in the hierarchy above it are rotated in any way at all, you get that weird suspension rotation. Fixed that, but now the instant the wheel touches the ground, it imparts some ludicrous force onto the tank, and it goes flying off the map, or it just goes straight through the ground.
Answer by RLin · May 04, 2015 at 10:55 AM
"but now the instant the wheel touches the ground, it imparts some ludicrous force onto the tank, and it goes flying off the map, or it just goes straight through the ground." What is the mass of the tank's rigid body? Unity 5 wheelcolliders require realistic values to function correctly. The default rigidbody mass is 1 kg. Considering that the suspension of each wheelcollider is designed to handle a car ranging from 1500-2000 kg in mass, it makes sense that your tank would go flying.
The tank weighs 20 metric tons, or 20,000kg. That's not the issue. Although changing that value doesn't seem to change anything... which may be because i have a value that is proportional to the tank mass... Gunna go check.
So I got it fixed, seems like it just didn't like the wheel colliders that were created in 4.xx, when I made new ones it worked just fine. Same parameters and everything.
Your answer