I tried to add local rotation to my character. So I put my code this way (into BindAxis function) :
AddActorLocalRotation(FRotator(0, Rate, 0));
RootComponent->AddRelativeRotation(FRotator(0, Rate, 0));
But nothing worked.
Do you have a solution to add local or relative rotation to the character ?
you simply add a Rotator to a given Rotation, so its fine although you need to be aware, that you always add your Yaw Rotation to your object.
Means it can result into an accelerated rotation (it spins faster and faster and faster).
However, from what you give us noone can tell why nothing rotates.
Have you debugged your code to check what values your “Rate” for your Yaw-input has?
Yes, I debugged Rate value. And it’s ok.
I just replaced “AddControllerYawInput” (working with “Rate” value) function with my examples.
Simply, I want to add local rotation with mouse axis, because my character can move on a sphere (So Yaw value of “AddControllerYawInput” can’t help me).
maybe this example can help you?!
just ignore the middle mouse.
It is in blueprint however but you can do it quite similar in c++
btw. does it work, but not in a way you like? or is there even no rotation at all?
Thanks for your answer. I searched this way and after some test I found this :
When Yaw has a value, nothing happened. BUT, for Roll and Pitch value, update is ok. The rotate is effective.
It is the same for SetActorRotation function like your link.
I think there is an option for Yaw value, for the moment I don’t find it (It is not “Use Controller Rotation Yaw”).
Do you have an idea ?
hmmmm not sure,
can you just add a node after Add Actor Rotation with GetActorRotation and check the Pitch, Yaw,Roll values?
btw. what happens when you AddActorWorldRotation?
See for yourself :
SetActorRotation get the new Yaw value. But “GetActorRotation” do not return this value.
The same result. Nothing happened. Yaw don’t work.
I guess something block… but what is it ?
I began with a new FPS project, options are default values.
I found something :
So after some tests, I put a skeletal mesh into the CapsuleComponent like this :
And in fact it’s working, with one problem :
The component turn like I want, but camera still fix on Yaw axis.
If I uncheck “Use Pawn Control Rotation” of “FirstPersonCamera” :
Yaw axis is ok, but Pitch still fix at this turn. I don’t understand why…
Finally, may be I understand how it’s work :
Controller Rotation don’t use Yaw relative rotation of character. With “Use Pawn Control Rotation” checked, Yaw does’nt retrieve.
So I uncheck this option, and set pitch axis like Yaw :
Do you think my answer is right ?
hmm, dunno but…
considering your last picture it seems your “Yaw” value is fixed, since yaw is responsible for Up/Down(around Y-Axis) rotation and Pitch is for Left/Right (around Z-Axis), this is in 3D space.
So when you want to LookUp/Down you should update on Yaw, than Pitch. And when you want to turn you update on pitch, except you intentionally inverted those for a specific purpose. (sorry i saw that just yet).
but wait a moment
ok i just notice when you add those two events (look up and turn)
the whole default mouseview is disabled. (you cant look anywhere)
going to check that out
and this option fixed it now.
It seems that those functions override the axis behaviour of the default PlayerController,
with that checkbox you seem to tell the engine to not use the behaviour of your parent class (which is a lower priority actor it seems)
can you test that?
I did your test, but nothing change. Check or uncheck override CheckBox gived the same result.
The values displayed into the screen are correct and depends mouse orientation.
For Yaw and Pitch axis, when I create new project see its proposal :
So When I move the mouse with Left/Right movement, the “Turn” axis mapping is called and controller Yaw value change.
Is it not what you have ?