# AddWorldRotation inaccuracy problem

Hello,

I am trying to align two actors A and B by adding the difference of the rotation of A and B to the rotation of A - just like you could make it to align it’s locations (A.location = A.location + (B.location - A.location). Don’t ask why I am doing it this way and why I not simply set the rotation of A to the rotation of B - I need to do it this way for another function. It should work, anyway.

When calling the function “New Function 0” (in the level blueprint) with the location this works without any problems. If I am doing the same with the rotation this happens:

It’s inaccurate! The rotation of both cubes is not the same. If I call “New Function 0” again (2 times at all), it’s slightly more accurate:

After three calls:

After four calls it looks good. Both cubes have almost the same rotation:

I think it’s clear that this has something to do with inaccuracy. I need to call the same function 4 times to get a good result.
How to deal with this? What is the problem? How to make it better so that I don’t need 4 calls?

Thank you,

Thilo

For some reason this works. Thank you.

But for some other reason, this does not work:

I am trying to align two scene components on their sockets, so that at the end both sockets have the same rotation and the same location. So I thought this would work:

• Move Component 2 for the difference of the socket locations of Component 2 and 1 -> both sockets have the same location
• Rotate Component 2 for the difference of the socket rotations of Component 2 and 1 around the socket of Component 2 -> both sockets **should **have the same rotation

There are cases of rotations of Socket 1 and Socket 2 where:

• this works
• this does not work, but it works with (5-10) iterations of this function
• even with infinity iterations it does not work

I don’t understand why this isn’t working…

Try this one:

Thanks. Unfortunately this doesn’t work if

setup of the first socket:

And of the second socket:

While using Shape_Cube for both static meshes.

Can you show a pic of how the cubes are supposed to look like in that example?

I think you got it already. There is something strange going on with the rotations. Maybe it has something to do with the order of Euler rotations…

I found an easier example.

This is socket 1 on cube 1:

This is socket 2 on cube 2:

Before calling the function they look in the world like this (I added debug coordinate systems with the socket’s transforms):

After the function (e.g. yours like above) they look like this (socket coordinate systems not fully aligned):

But they SHOULD look like this (looks like one coordinate system, because both socket’s coordinate systems have exactly the same origin and rotation):

It makes me crazy that I can’t get this to work

I really don’t know, why, but this seems to work:

1. Rotate the scene component 2 to that it’s socket rotation is (0,0,0)
2. Rotate the scene component 2 to the rotation of the socket rotation of scene component 1

Just test it and it works. Nice.