How to make component rotates according to the location of another component

I am very new to game engine and ue4 so please forgive my stupid methods, I want to make piston0 rotates according to piston1’s pivot, is that possible? Thank you

Really appreciate your explicit answer, but what I actually want to know is how to make the mesh of piston0, rotates towards the pivot of piston1, such that piston0 is always pointing towards piston1’s pivot, sorry for my poor interpretation.

To change the pivot location in the editor, you can drag it by pressing Alt + Middle Mouse Button, or by selecting the respective menu option after right clicking the actor; and you can save the pivot position in the same menu. If you do that a lot, I recommend setting hot keys for that.

If you want to offset the in-game pivot, that’s where it gets trickier, because the in-editor pivot has nothing to do with the in-game pivot. For now, the only 100% working method I’ve come across is offsetting the model in the 3D-editor you import it from; the 3D editor 0,0,0 point will be the pivot, even if the model itself is located elsewhere.

As for the assets created in the UE itself, I have no solution, unfortunately. You can add a Rotating Movement component to the actor and set a pivot offset there, but that offset will only affect the rotation done by the Rotating Component, and it’s always in local coordinates, so you can’t just set a point in space for that. Maybe you can do some math subtracting world coordinates of those two actors from one another and setting the offset based on the result, but I have never tried that, I don’t even know if you can access the pivot offset from blueprints. If you can drive all the movement you need with a Rotating Component, you can try and make use of it.

Edtd: Oh wait, you can try this: create any empty component in the blueprint where you want your pivot to be, and attach your Piston0 to that component. Then you apply rotation to that parent component, and not to the Piston0 itself.

Oh, I see.

Well, there’s a great node called Find Look At Rotation, you can use it in the level blueprint, but I don’t know if you can use it in actor blueprints, I’ve never tried to.

If you can, what you can do is Find Look At Rotation from Piston0 to Piston1, and then set Piston0 forward/up/right vector to be Rotator value the Find Look At Rotation node return (depending on which axis represents the end of Piston0 that should be turned towards Piston1).

For smooth rotation you can execute that on Tick.

I hope this is clear, because I can’t show you any screenshot right now.

have you tried Get Look At Rotation?

I see, I will give it a try when I have the chance, thanks a lot