Wheels don't spin with motor cannon.js


So I’m trying to make a car. Nothing to fancy, just to make a car to have a car. I have an axle, and two wheels. WASD to move, w and a to move forward and backward, a and d to turn left and right. Somehow, you can turn but not move straight. The axle spins instead, and even when turning.
https://playground.babylonjs.com/#7QLJWW#8 : playground to try
https://playground.babylonjs.com/#7QLJWW#6: playground with axle mass 0 to show that the wheels spin.

@Wingnut and I have been trying to figure it out, but it seems that the physics engine thinks that there is nothing to push against when moving straight.

Also, when using oimo the wheels spazz out : https://playground.babylonjs.com/#7QLJWW#7

Any ideas @Cedric

With a big axle it works okay:https://playground.babylonjs.com/#7QLJWW#11
but the wheels don’t stay aligned

Hi @Givo

I did a quick try and improved the stability by increasing the mass of the axl.
When the mass is too low, the wheel add oscillation and instability in the system.
It needs more tweaks on the restitution/friction to be fully stable


Is restitution like bounciness?

Okay, https://playground.babylonjs.com/#7QLJWW#14
I added a lock joint and a beam. But how do I readjust where the beam is? I always centers on a weird position and I don’t know what property moves it.

I’ve done a little playground with a 4 wheeled car.
No direction yet and it’s more stable with 4 wheels. It needs more tweaks (you can make a UI, it’s easier for tweaking) but the basics is here


I changed the mass and it looks even more like a car now


Cool! While you did all that I added backwards :upside_down_face: https://playground.babylonjs.com/#TYD4D6#3