Subtract Mesh Position from another Mesh Position

Hello,

I’ve created a playground where an arrow mesh follows a sphere after you click and drag the sphere.
I’d like the arrow to stop 0.5 meters or units away from the sphere.
Also I’m trying to get the new position of the arrow so when if you drag the sphere again, the arrow doesn’t reset to it’s original position but starts the animation from it’s new, current position.

Thanks you kindly!
David

you would need to compute the correct position by I guess finding the direction (with substract and normalize) and then add this direction scaled by (the previous length - 0.5) so the start position I guess :slight_smile:

@Cedric might have better tricks

1 Like

What Sebavan said :slight_smile: There is no trick here. just pure vector manipulation. With just a few operations, you can already do a lot: vector add/sub, normalization, compute length of segment or distance between 2 points, cross and dot product. that’s 95% of manipulation I’m doing when coding.

@sebavan and @Cedric thank you for the responses. I will have to take a deep dive into vectors.

2 Likes