- Home /
WheelColliders turn outside down and floats away
Look, all i want to do is make a car. Every update there seems to be a new problem for me with WheelColliders, this latest one is tricky and i don't understand what is happening. Basically when i try to update my Wheel Transforms (which have the Colliders as components), they flip upside down but now around their own axis, actively flipping the car on its roof and then floats away in a diagonal line upwards and right. What... the... ####?
Also worth noting is that i tried setting localPosition instead but then they fell through the Plane i have the car placed on.
Here is the code:
private void FixedUpdate() { UpdateWheel(FLWheelCollider, FLWheelTransform); UpdateWheel(FRWheelCollider, FRWheelTransform); UpdateWheel(RLWheelCollider, RLWheelTransform); UpdateWheel(RRWheelCollider, RRWheelTransform); }
private void UpdateWheel(WheelCollider col, Transform trans)
{
Vector3 pos;
Quaternion rot;
col.GetWorldPose(out pos, out rot);
trans.position = pos;
trans.rotation = rot;
}
Update: I separated the Transforms and Colliders into separate objects (used Empty Gameobjects) for colliders, then placed them in the same position, etc. Now they turn 90* so they lay horizontal instead of vertical...
Okay great another update, didn't change the code. Worked like i described in my previous comment 3 seconds ago, started it again and guess what? Now they are not only horizontally rotated, they are also 20 meters from the car and underground...
Okay i got it "working" atleast it doesn't do that but now motorTorque doesn't work, i followed a YT tutorial from 2020 that said "RLWheelCollider.motorTorque = inputY * motorForce;" nothing happens, it doesn't move. I hate WheelColliders, they are absolute trash.