Quantcast
Channel: Questions in topic: "wheelcollider"
Viewing all articles
Browse latest Browse all 490

WheelCollider - Problem with model rotation

$
0
0
First of all I have to mention that I have just started to get familiar with Unity engine, so my question is probably really basic. :) As my first task I would like to create simple car with simple controlling so I followed this tutorial on Unity's site: [WheelCollider Tutorial][1] I could achieve to control my car but I stucked at adding a visual model to wheel collider. Here is my object hierarchy and how I set the models: ![alt text][2] And this is the scene and game windows: ![alt text][3] As you can see on the scene screen the wheels' rotation is fine but when I start the game it goes wrong. The wheels are turning and rotating but on a wrong way furthermore the car is not moving when I rotating the visual models. If I turn off the visual rotation the car is moving. My assumption is I cannot rotate the wheels' model on scene because it will be rotated back according to the script: (I'm using the same code which is in the tutorial) collider.GetWorldPose(out position, out rotation); visualWheel.transform.position = position; visualWheel.transform.rotation = rotation; So my questions: - How should I set the visual wheel models to display them correctly on scene and in game as well? And keep the car moving. - The tutorial gets first child transform and after that it gets again transform of visualWheel. Why it is necessary? Shouldn't we use only visualWheel? [1]: https://docs.unity3d.com/Manual/WheelColliderTutorial.html [2]: /storage/temp/80041-unitiywheelcollider2.png [3]: /storage/temp/80042-unitiywheelcollider2.png

Viewing all articles
Browse latest Browse all 490


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>