- Home /
How to properly use WheelCollider GetWorldPos
Hello, I have made a little script for car and I want to make wheels visually spin and move up and down (just as the actual WheelColliders do). From few youtube tutorials I saw that everyone use GetWorldPos, but somehow no version works for me.
Now I have typed private void AnimateWheels() { foreach (var mesh in meshes) { Quaternion _rot; Vector3 _pos; wheel.collider.GetWorldPose(out _pos, out _rot); wheel.model.transform.position = _pos; wheel.model.transform.rotation = _rot; } }
But it gives out error "wheel does not exist in the current context" CS1013. In hiearchy I have seperate parents WheelCollider with 4 children (front left front right rear left rear right) and WheelVisual also with 4 children (Tire FL tire FR ...)
What should I add to my code above to get wheel.model.transform to work? Thanks