Problem with rotation while attaching an actor to another actor.

Hi
I am facing an issue with the rotation of a component while attaching an actor to another one. My parent actor has a rotation of (roll = 0, pitch = 0, yaw =0) and at a point I am attaching an actor with rotation (roll=0 pitch=35 yaw = 90) But as per the rotation of unreal the attached actor is not rotating as per my need.

In the current case first it rotated around Y axis by 35 and then rotate by Z axis

and the thing is need is like this:

So is there any method available to get it right ?

The simple solution would be to secondobject->SetActorRelativeRotation() after attaching to parent object.

1 Like

Hallo
is it possible to chnage only one component. I mean only i need to change x. if I put zero other will set to zero. so what can I do to change only the x rotation ?

Hey there @ronyshaji1! Here’s the documentation page for the Set Relative Rotation for scene components. So get a reference to your scene component, then use SetRelativeRotation to whatever you need it to!

@SupportiveEntity Does the rotation obtained using euler angle and the quaternion are same in unreal engine ? I mean if I convert my euler angle to quaternion and those will end up in same position ? (if we ignore gimbal lock issue)

Quaternions need to be converted down to Euler angles before being able to be used with the rotators I believe. The gimbal lock also does still apply to the relative rotations as well.

1 Like

Is there any provision available in unreal engine to change the rotation order. It is causing trouble for me.

If there is a way to change which rotation type ie Quat or Euler? Then no, there’s no way to change what the function accepts, if you mean instead of how to circumvent the gimbal lock, setting the variable directly between each of the values (x,y,z) are a bit different.