How to clamp movement of a component to a circle around its actor.

How do I clamp a component to a circle around its actor in BP. My current formula creates a diamond shape.


If they’re gonna be separate actors, you can simply set the location of the sphere x units further by using the Get Actor Forward Vector and Set Actor Location / Set Actor Relative Location nodes. Hope this helps :blush:

It will be a component on the actor. I also want it to be clamped within* the circle not just the perimeter.

You want to be able to rotate it on Mouse X input and adjust the radius on Mouse Y input? You can just promote the other pin of the multiplication node (which has one of it’s pins connected to the forward vector) into a variable and adjust it’s value accordingly.


I’m not talking about the existing multiplication node in your blueprint code though. It’s the new one that I described previously. You can determine how far the sphere should be while rotating by adjusting the value that we’ll use to multiply the forward vector of the actor we’re rotating it around. Then again, place the sphere on that location either by using the world location or the relative location.


In that case, I think it’d be better to add a spring arm component as the parent of your sphere. Once that’s done, you can simply rotate it on Mouse X input and adjust it’s length on Mouse Y input.

Use POLAR coordinates to move component, ie. Angles + radius. Will make everything much easier.

Or clamp to circle instead of [x,y]:

  • get vector from pawn to component,
  • normalize it,
  • multiply by circle diameter.
  • You will get new [x,y] that is on circle.
  • Then clamp to that value.