Displacement of the car when turning its wheels

Playground: https://www.babylonjs-playground.com/#AYD85K#18

Explain to me please. Why, if I reduce the scaling vector of the machine even by 0.1 x, y, z, and then when turning the wheels the car starts to shift strongly along the x?

 car.scaling = new BABYLON.Vector3(1, 1, 1);

Scaling affects the local space of the machine, so with a scaling of 0.9 and doing:

car.translate(BABYLON.Axis.X, NR - R, BABYLON.Space.LOCAL);

NR - R will be scaled by 0.9 as well.

And if I want the final vector 0.5, 0.5, 0.5. Should I multiply the difference (NR -R) by 0.125?

You can do (NR - R) / car.scaling.x for translating in the X-axis

I tried to write as you said, but the car still moves when turning

It works for me (only changing the car.translate parameter):

https://www.babylonjs-playground.com/#AYD85K#20

2 Likes

Nice, but why should I divide the difference only in the displacement of the machine itself, but there is no pivot?

Because the scaling of the pivot is still (1, 1, 1), it’s only the local space of the machine that has been affected

1 Like