made a simple playground (finally figured out how to use the playground ).
https://playground.babylonjs.com/#8EVURR#2
can anyone show me how to move my cube to the target using vector subtraction? (so, it’ll move maybe idk slowly to the target).
made a simple playground (finally figured out how to use the playground ).
https://playground.babylonjs.com/#8EVURR#2
can anyone show me how to move my cube to the target using vector subtraction? (so, it’ll move maybe idk slowly to the target).
Not sure about substract but here is animated example - https://playground.babylonjs.com/#8EVURR#4
Thank you for showing me this; do you have an example of just moving a mesh from point a to point b with a vector? I believe you use vector subtraction an x% each frame.
Subtracting two non-normalized vectors will yield a vector that points in the direction you want to move. Vector.Distance is a way of getting just the distance.
The magnitude (length) of the result from subtracting two vectors tells you how far the total distance between the two vectors is, whereas the normalized vector is the directional components.
Every frame, you can perform that operation and then choose to move your object by whatever % of that distance you wish. ‘Scalar.Lerp’ or Scalar.SmoothStep will perform their respective easing operations on the value given the ratio of start position and end position distances.
Ed: here is an algorithm you might implement: