Hi, I’m trying to get the direction from an origin point in the world to another world position (Vector3).
I guess this should not be hard but I could only find posts on how to rotate a mesh or angles between meshes.
I need to fire a ray from one point in the world to another point in the world.
How can I achieve this without adding rotations etc.?
To get a directional vector3, we subtract the current position from the target position.
let direction = toPosition.subtract( fromPosition );
Now, “fromPosition” + “direction” === “toPosition”
We normalize the direction vector3, so it has 1 unit length.
let direction = toPosition.subtract( fromPosition ).normalize();
there you have it
I now see I was substracting the wrong values in my code, but this works!