How can I temporarily move the pivot of a mesh/actor in runtime?

** edited as it was too long and obscure of a question.

Hello superstars.

I’m wondering if there’s a way to - in blueprints - change the pivot of a mesh or actor (for example from the center to the very left of the object) in runtime?

I’ve tried pivot translation within the rotation movement component but can’t get it to work.

Thanks in advance.

Hi there, an important distinction to make here is the difference between Components and Actors.
A single actor can itself contain many components - both types can be transformed. Component transformations are relative to the actor origin whereas actor transformations are in world space.

To take a simple example, you might have an actor that contains a single mesh component that is a 10x10x10 unit cube. With no transform applied to the component or the actor, this will have its 3-dimensional center at the origin.

If you wanted to rotate around one of the edges, you could translate the inner mesh component by (5, 5, 5). This would put the origin of the actor at one of the far-most corners of the cube. Any rotation you apply to the actor will be around this point.

I hope that makes sense?

Thanks for the response!

I think what you’re describing is just offsetting the mesh to rotate at that point. Meaning that it will still do a 0,0,0 origin rotation from another position in the world. Maybe I misunderstand what you mean in your solution.

What I want to do is to have a cube roll over one of its lower edges given a key press (on a chess board, the cube would be moving from square to square with a hinge-like behavior. I would like to see if there’s a way to do it without C++ and without having to do some kind of matinee or animation trickery. Essentially what I want is the same behavior you get when moving the pivot of a mesh in the editor and rotating around it. The two possibilities I can think of is some mathematical solution with changing the rotator or changing the pivot in some way more persistent way.

Thanks for clarifying, Tompen. I hadn’t realised you wanted this to be a dynamic thing - if you wanted to do something in blueprints, I’ve made a function that you can call to rotate an actor around any point and axis:

5822-call-site.png

The function looks like this:

What we’re doing here is handling the location and rotation separately. I’ve done this with rotators and vectors for clarity, but you could equally do this with transforms.

We take the current location of the actor, and subtract our “point-to-rotate-around”, then apply the rotation around the axis - this ensures the location change is calculated relative to the rotation point. We then add on the rotation point again.

The rotation is simpler, as you can see.

I hope this helps, let me know if you have any more problems!

Hi there ! I have been strugling for a long time now trying to get my camera setup working for a project of mine but can’t get it working! It looks tho like what you have created is something i believe is close to the solution to my problems! What i am trying to create is a sort of towerclimbing game but in 3D. The camera will be in the middle of the tower just moving up and down using the Z axis while the player will be controlled by rotating the Z axis so he kinda runs in a circle all the time but since it’s a tower the player will progress through the tower by getting higher up. Here is a image explaining what i mean:

Could you maybe explain to me a bit how i can recreate that blueprint you created cause i am a 3D Artist by trade and doesn’t have much experience using Blueprints i’m afraid. And maybe this isn’t the solution but maybe you know how i can bring my idea to life?

Cheers!
//

Hey , there’s a great set of tutorials available for blueprints if you’ve not used them before: null - YouTube

I’d recommend having a look through some of those and then ask us any specific questions here on answerhub. I would have thought the function I posted above would do what you want, with a little modification.

Thanks for the quick answer! I have looked a bit on them but i will dive into them some more! Cheers! I just have another question. How did you create that purple box that says “Rotate Actor Around Point”? Here is a image showing which i mean:

So the purple box are the inputs to the function - I implemented this as a function so it can be reused easily. If you have a look in the top left hand corner of the image there’s a button to add a new function. This will give you an entry in the panel which you can open on its own.

Thank you . I think the answer to my pivot question is implied in your math answer too =) Your solution works great though.

This is a long shot, but I figured I’d ask here anyway. I’m making a Super Monkey Ball type game where the stage rotates around a ball, and have used this function twice for it-- once for the x-axis of a joystick, and once for the y-axis. It’s gotten me really close to what I want. However, with the way this function works now, when I hold down any given direction of the joystick, the stage rotates in that direction and stays rotated. What I want is for the rotation of the stage to correspond to how much the joystick is being pressed; ie, the stage is flat when the joystick is untouched, and tilts up to when the joystick reaches its bounds on the controller.

With that in mind, would there be a way to alter this function to make that possible?

I successfully created runtime pivot change. you can look at it.