Hello, I want to add customization selections for my game like camber. I dont know how can I make it?
The WheelCollider itself can only be vertical with respect to the rigidbody it belongs to. You could only define pose of the visual wheel yourself to make it look like it has camber.
Thank you for answer Edy, Code (CSharp): public void ApplyLocalPositionToVisuals(AxleInfo axleInfo) { Vector3 position; Quaternion rotation; Vector3 camberAxle = transform.right; axleInfo.leftWheelCollider.GetWorldPose(out position, out rotation); axleInfo.leftWheelMesh.transform.position = position; axleInfo.leftWheelMesh.transform.rotation = rotation * Quaternion.Euler(-camberAxle*camberAngle); axleInfo.rightWheelCollider.GetWorldPose(out position, out rotation); axleInfo.rightWheelMesh.transform.position = position; axleInfo.rightWheelMesh.transform.rotation = rotation * Quaternion.Euler(camberAxle*camberAngle); } I tried to make it with this code but it is wobbling. I don't know why. Can you help me about it please?
Hi just a thought when I read this (meeting a similar problem), how about putting each wheel into a parent object, and tilting the parent instead? My idea is like this, for each update: 1. Set rotation of parent to aligned with rigidbody 2. Set wheel transform position and rotation 3. Tilt parent object to desired camber angle
@Ceylan12 I don't know, maybe it's about the quaternion multiplication not being commutative (order matters). @AugGust It won't work. The WheelCollider will be vertical with respect to the Rigidbody it belongs to, no matter the intermediate hierarchy.
It look really sensible, I didn't try it maybe it could solve my problem. I created another parent for camber and set the parent angle to this object. It worked. Thank you very much.
I was thinking about the "visual only" object, not the wheel collider. Cool maybe i'll try what Ceylan said, the cars look weird with 0 camber