11116
March 29, 2020, 7:57pm
1
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);
Gijs
March 29, 2020, 8:25pm
2
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.
11116
March 29, 2020, 8:27pm
3
And if I want the final vector 0.5, 0.5, 0.5. Should I multiply the difference (NR -R) by 0.125?
Gijs
March 29, 2020, 8:38pm
4
You can do (NR - R) / car.scaling.x
for translating in the X-axis
11116
March 29, 2020, 8:50pm
5
Gijs:
(NR - R) / car.scaling.x
I tried to write as you said, but the car still moves when turning
Gijs
March 29, 2020, 8:52pm
6
It works for me (only changing the car.translate parameter):
https://www.babylonjs-playground.com/#AYD85K#20
2 Likes
11116
March 29, 2020, 8:55pm
7
Nice, but why should I divide the difference only in the displacement of the machine itself, but there is no pivot?
Gijs
March 29, 2020, 9:25pm
8
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