Let me start by saying thank you for taking the time to read this and I humbly request help with an issue where I rotate an actor via Set Rotation but want to maintain consistent Add Actor Local Rotation to it.
Goal:
The character’s rotated in space to match the direction of a new gravitational force while having the mouse axis x input rotate them side to side.
My Logic:
If you can rotate the actor in space, then adding a relative rotation to it should be consistent no matter what direction the actor is in world space.
Issue:
The rotation axis, I presume, gimbal locks when the actor is rotated in a specific way.
The actor, when either in default rotation will rotate correctly left and right and when flipped 180.
When the actor is rotated 90 degrees ROLL the side to side rotations gimbal lock.
However when the PITCH is rotated 90’s the side to side movements are none.
Bonus Question:
In addition, if at all possible, I’d like to lock the actors roll so that it doesn’t spin out of control when it bumps into an object.
If you do the whole thing with rotators ( no pin splitting ), you’ll be ok.
In order to add rotation, you’ll need to put the value you want to add in a rotator variable, plug that into a ‘combine rotators’ node ( with the current rotation ), then set the object rotation.
It might also work to add rotation using rotators.
The rotator nodes handle gimbal lock, you can’t do it with split pins, because rotation is more subtle that that
Wow using rotators did the trick for making the gimbal not lock out when the actor is in any direction! Thank you.
Sadly however, the set rotations were happening on tick so with them enabled the gimbal returned even with the rotators. Is there an easy way to make the players up vector always face specific vector or at the very least lock certain rotations on command?
There’s a bit of a knack, and I can’t tell you specifically which ones to use in your case. You might get somewhere by using what you already have in combination with one of these, ‘make rot from XZ’, for instance, is saying ‘I want to mainly take the rotation the X I’m supplying, but I also want to try and align Z to this other axis’, and the engine will have a best attempt.
Thank you again! That was close to what I wanted but was not exactly it. I did find that using a PhysicsConstraint gave me the limitations I was hoping for while also not being an On-Tick effect, though I found that when I rotate the Actor it gives diagonal rotations when the mouse input is effecting the rotation.
Works exactly as planed when using starting rotations:
When the rotation is set to another value the mouse rotations becomes an odd diagonal movement. Im guessing thats because part of the rotation is Locked. Shouldnt the constraints rotation orientation match the BP_Player/StaticMesh_Ship since they’re children of it?