In babylon, know the position of object B, the distance and direction between object A and object B, and how to determine the position of object A

In babylon, know the position of object B, the distance and direction between object A and object B, and how to determine the position of object A

Here a draft code:

var direction = ... // A - B
var normal = direction.normalize()
objectA.position = objectB.position.add(normal.scale(distance))

If direction is B - A, then add .negate()-function between normal and scale.

4 Likes