How to make object rotate around another object?

r.jpg

i want the parent to just rotate around the child object when player holds down Q, when they let go of Q the rotation stops.

I’d rather not resort to tricks or hack jobs.

i know the world location of the sphere and the parent. There must be some kind of node that does this.

You could switch the parent child relationship, so that the camera is the child of the sphere. Then simply rotate the sphere and the camera will follow.

Do you want the camera facing the sphere while rotating?

That would be great. Everywhere I look, people are trying to figure this out, but can’t.

The thing is what you called hacking and tricking is the most simple and indeed most established way to rotate an object around a pivot point.
Everything else would be tricking and hacking. So if you did not set up anything yet i strongly recomment to do it this way.

The problem is you want to rotate the parent around the child. So you make the parent constrained to the child. But as the child is constrained by the parent (as it is its child) you will get an dependency loop. And loops are always bad! This could go well if you do not move the child while rotating the parent (however still hacky) but as soon as you do both it will stop working correctly!

You could imagine a parent child relationship as a pregnant woman. Whereas the woman is the parent (obviously ;)) and the baby is the child. Now you see that you can’t rotate the child around the parent, or at least it would be somewhat unnatural! :wink:

See this link for the Parent Child analogy. :wink:

Hope it helped!

1 Like

This is the worst answer I’ve ever seen in the history of answering a question.

2 Likes

Here is how you rotate an actor/pawn/object whatever around any other actor/pawn/object. With this code you can rotate anything with a vector3 worldLocation around anything else that has a vector3 worldLocation. Hopefully this function gets implemented as a core function in UE4.

You can call the event from say a turnLeft turnRight axis event for q and e rotational movement. The direction is based upon the axis you feed it, positive makes you revolve around the object to the right, negative left.

keywords - rotate around an actor object pawn

For years man has yearned to rotate objects around other objects in UE4, now that dream is a reality.

2 Likes

Seriously? That rude? I just tried to help you (voluntarily) and that is your reaction to it? Dude, thats sadden me!

Here’s my variation of this. It’s for snap-rotating the player’s VR origin around the current camera position so that the player’s absolute camera location stays the same.

1 Like

Doesn’t Work !

I wonder if they changed something in the new versions of EU? It worked perfectly for me when I used it.

I know it’s been some time, but I wanted to say that your solution looked fine, so I built that up into a function in a project I was working on to test it, and I can confirm your setup works as intended.

Hopefully someone else who stumbles upon this can use it, and isn’t turned off by others saying it isn’t working.

1 Like

This works perfectly in 4.26 too

Can anyone help me with this in 5.3? Im trying to get a camera to orbit around an object and once the player moves over to focus on a new object it focuses on the new object and orbits around it. Kind of like a drone.