Search code examples
unreal-blueprintunreal-engine5

Rotate point around pivot point?


I have two points, an origin one, and a target one.

I need to rotate the target one around the origin one by a given amount of degrees along the Z axis.

I see there's a "Rotate Vector Around Axis" but I can't find one that also supports a pivot point.


Solution

  • First use find look rotation between your origin and target to compute the needed rotation angles needed. There are many other way to compute angles but it is the simplest solution imo.

    Then with this rotator you only have to set rotation of your component.

    https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/AActor/SetActorRotation/

    In general, setting a location or rotation is made around the object pivot.