# How to rotate around an arbitrary point?

**URL:** <https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132>\
**Category:** Community & Industry Discussion\
**Tags:** rotation, unreal-engine, question\
**Created:** [May 12, 2014, 5:48am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132 "2014-05-12T05:48:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrpdean](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mrpdean](https://forums.unrealengine.com/u/mrpdean)\
**Post date:** [May 12, 2014, 5:48am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/1 "2014-05-12T05:48:25Z")

</div>

How can I rotate a mesh around an arbitrary point in space?

For example a moon rotating around a planet.

Thanks

---

<div class="post-metadata">

**Author:** ![C0deH4cker\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@C0deH4cker\_1](https://forums.unrealengine.com/u/C0deH4cker_1)\
**Post date:** [May 12, 2014, 6:42am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/2 "2014-05-12T06:42:57Z")

</div>

If you already know the distance and the rotation, you can do something like this:

 ![6100-screen+shot+2014-05-12+at+2.42.25+am.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/2/b027ebc427d226259a90ae3bdbcdc1ade48630c1.png)

This function will return the final location for the mesh. Also, you should set the mesh’s rotation to the same rotation used in this function.

---

<div class="post-metadata">

**Author:** ![mrpdean](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mrpdean](https://forums.unrealengine.com/u/mrpdean)\
**Post date:** [May 12, 2014, 7:42am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/3 "2014-05-12T07:42:39Z")

</div>

Perfect. Thanks!!

---

<div class="post-metadata">

**Author:** ![brunogbrito](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@brunogbrito](https://forums.unrealengine.com/u/brunogbrito)\
**Post date:** [July 16, 2014, 4:20pm UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/4 "2014-07-16T16:20:16Z")

</div>

Would be possible to create a blueprint function that generates an ellipse movement around an arbitrary point in space. A function that we could input the center point position + the two ellipse focus points positions (that will define the ellipse shape). Is there a way to do it?

---

<div class="post-metadata">

**Author:** ![Rumbleball](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rumbleball](https://forums.unrealengine.com/u/Rumbleball)\
**Post date:** [March 11, 2021, 9:20am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/5 "2021-03-11T09:20:03Z")

</div>

Here is my solution to it. It will rotate the object around the given Pivot using the objects own rotation. E.g. A delta rotation around Z will rotate around the objects Z axis. Optionally you can retain the rotation of the object itself.  
You can write this as a function, for sure.

 ![332096-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/5/6/b56314b3d7237b91949d03eda64050c219031145.jpeg)

```
	UFUNCTION(BlueprintPure)
		static void RotateAroundPivot(const FTransform& Original, const FVector PivotLocation, const FRotator DeltaRotation, bool bRetainOrientation, FTransform& New)
	{
		FTransform PivotTransform = FTransform(Original.GetRotation(), PivotLocation);
		FTransform DeltaPivotToOriginal = Original * PivotTransform.Inverse();
		New = FTransform(DeltaRotation.GetInverse() * (float)bRetainOrientation, FVector(0,0,0)) * DeltaPivotToOriginal * FTransform(DeltaRotation, FVector(0,0,0)) * PivotTransform;
	}
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_67fd1278](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_67fd1278](https://forums.unrealengine.com/u/anonymous_user_67fd1278)\
**Post date:** [October 3, 2022, 1:32pm UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/7 "2022-10-03T13:32:55Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/e/0cee9e84ace4736fc5234dd5582c0f65376e4116.png)

---

<div class="post-metadata">

**Author:** ![IntelliToasters](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IntelliToasters](https://forums.unrealengine.com/u/IntelliToasters)\
**Post date:** [April 6, 2023, 11:33am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/8 "2023-04-06T11:33:06Z")

</div>

This works regardless of the initial orientation as it doesn’t require the forward vector and has solved my issue of rotating a parent actor around a child actor. I’ve been struggling with this for hours. Thank you so much!

---

<div class="post-metadata">

**Author:** ![TepDaddy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TepDaddy](https://forums.unrealengine.com/u/TepDaddy)\
**Post date:** [April 24, 2024, 6:38pm UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/10 "2024-04-24T18:38:53Z")

</div>

I found a good way to do this was to do something like this:

```auto

    FVector pointLocation = ...
    FVector thingYouRotatePosition = ...
    float amountYouWantToRotate = ... //(0-2pi)

    // make a Quaternion with an upward axis (rotating around the upwards axis)
    FQuat rotation = FQuat(FVector::UpVector, amountYouWantToRotate);

    // get the offset of you the thing you are rotating, from the point
    FVector offset = pointLocation - thingYouRotatePosition;

    // rotate it and add that to the point location
    FVector newRotation = rotation.RotateVector(offset) + pointLocation;

```

Quaternions are really handy once you learn how to use them. Though most of the explanations I’ve seen seem a little complicated.

How they work is that you give them a vector that tells it what to rotate around, and then you tell it how much to rotate around that ‘axis’. So if you give it a vector that points straight up, it’ll rotate around that like I did above.

---

<div class="post-metadata">

**Author:** ![DaL1gh7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DaL1gh7](https://forums.unrealengine.com/u/DaL1gh7)\
**Post date:** [July 8, 2025, 12:36am UTC](https://forums.unrealengine.com/t/how-to-rotate-around-an-arbitrary-point/283132/11 "2025-07-08T00:36:06Z")

</div>

You are a savant and a god, I swear you are the only one who gave me the right answer.

Thank you so much for your input to society!!! 😭
