How to get max radius location between two spheres

Basically I want to teleport my character within the range of the Red Sphere, so i need to get this sphere max radius location or something similar

If the mouse cursor is within the red Sphere it would teleport exactly where the cursor is, but if it’s outside this sphere, I’d want it to teleport to the max range of the Red Sphere (at the direction of the cursor)

You need to:

  1. Get the direction vector from the character to the mouse click
  2. Multiply that direction vector with te distance from character to mouse click clamped to the sphere radius.
1 Like

Thanks for the reply!!

I tried it but I think I messed up in something as I couldn’t reach the result expected

After the multiply, add the character’s world location vector. As is you are spawning it at the world ( 0,0 ) + the sphere radius. :grimacing:

1 Like

Omg that’s it, thank you so much for the help :blush:

1 Like