Skateboard physics and Wheel Colliders
Hi, I'm learning Unity and haven't done much but a few tutorials, so please bear with me. I've been trying to simulate skateboard physics so what I want is a skate object that has Rigidbody and I want to move it around applying forces and not transform.
I've been trying to use wheel colliders but I ran into problems. My setup is Skate game object with Rigidbody and a script that pushes is when button is pressed, then I have child game objects with meshes and colliders and also 4 child objects with wheel colliders. Since I don't want any suspension I set Suspension distance and Force App point distance to 0. All Suspension Spring settings are at 0 and Wheel Damping Ratio at 0.0001. Wheel Mass is at 0.10 (100g), Radius at 0.003. Everything else is left Default. Also in my PlayerController script I set motorTorque for all my wheel colliders to 0.000001f.
The problem is that my Skateboard starts to jitter and twitch when I start the game, it moves forward when force is applied, but you can see the wheel colliders are not turning.
I have mass of 2.5 on my Rigidbody, because I want to be same as real world weight for realistic physics (2.5kg). I've read that you should use bigger mass, with wheel colliders because of the suspension settings, but I have those set to 0. If I increase mass of my skate object, wheel colliders start to roll correctly when force is applied, but the jittering still persists although it's less noticable.
My main question is is my approach correct? Since all examples of wheel colliders I found were using them to apply torque and move the vehicle forward, but I just want them to spin freely (wheels don't move the object, pushing the object makes wheels roll). Are wheel colliders the right way to go, and I just need to adjust some settings to get it work properly, or should light objects with free spinning wheels be approached in a different way?
Answer by TheNightfly · Jul 09, 2017 at 01:00 AM
If you want just the illusion of the wheels rolling you might just get rid of the wheel colliders and have the wheels spin using transform rotate*the z forward motion of the board. You could also create a spin variable that you could multiply the wheels transform.rotate by to tweak how much the wheels visibly rotate so it looks correct for how much the board moves forward or backward.
Your answer
Follow this Question
Related Questions
Wheel Collider problem 1 Answer
I would like to better understand the physics of wheel colliders. 0 Answers
How to make the skateboarder rotate 0 Answers
When key pressed addforce,How do I add force when key pressed. Skating physics 0 Answers
Wheel Colliders - Cannot Attach to Vehicle/Super huge??? 1 Answer