I have learnt that the yaw axis used by the node ‘add controller yaw input’ is not relative so I would know if it’s possible to find an other way to allow my pawn to rotate depending on a relative axis.
what do you mean by relative? that node is for adding rotation not setting rotation so its not really relative or world. if your talking about how if you try to add say 90 to the rotation but it ends up being much more then thats due to the scaling. you can change the scaling amount in the player controller as shown in the below picture.
another option would be if you wanted to set the relative rotation of the camera you could just get the relative rotation then use a combine rotator and a set relative rotation. though this may not give the effect you want if you directly target the camera.
you say you want your pawn to rotate on the relative axis but actors always rotate on their own axis so i dont really understand what you mean. in general better define and describe your question so we can have a better understanding of what your looking to do.
What I wanted to mean, it’s that I have a pawn with a FloatingPawnMovement component and I use the node ‘add controller … input’ on x, y, z. However when I rotate to the top or the down then I turn around the yaw axis, it happens the same thing that around the roll axis, so I have concluded the yaw axis is fixed whatever the rotation ( not relative to the rotation). It’s awkward when my pawn does a roll and turns wrong around the yaw axis.
ive been playing around with some possible solutions and workarounds for a bit and ive got something that may work. basically instead of using the control rotation you can just add a local offset to your current rotation as you can see in the below picture. when making this i imagined something like a flight game and based the controls off of that and used a gamepad for testing. i used axis inputs to keep things simple and to provide analog values for the rotation. i also had input scale modifier for testing purposes. and as a last note for this to work you will need to uncheck the use controller rotation options in the pawn section of the details panel for class defaults as shown on the right of the picture. let me know if this helps or is on the right track.
Are you talking about gimbal lock? When the pitch (looking straight up or down) is at 90 degrees you end up spinning around the world “Z” axis? Because that is an entirely different issue which you can fix by using quaternions instead of Euler angles for rotation.
ThompsonN13, I have tested your solution and it works , thank. Now I just have to find a way to limit angle values.
Nebula Games, it seems it was my issue, but I don’t know how use quaternions: can I use them in blueprint?
I have a problem when I rebuild the project. The errors are ‘pointer to incomplete class is not allowed’. What do I have to do ?
Screenshot the error. Also did you make sure you changed the function signatures from the “myfunctionname” to your exact c++ class name?
Ah, screen shot the top few lines of code in the .CPP file, I have seen that error occasionally when Visual Studio doesn’t create the .CPP and .H files properly. The first line it wants is the UFlight_quaternions.h and then the other header files. But show me the first few lines I can give you a better idea of what to try. Fixing that might fix the other issues as well.
Finally, I tried again and it works, I don’t know why. Thank you anyway for your help and your tuto.