Download

Rotate Character with Mouse Axis

I’ll try to keep this simple.

I have a character with a camera attached, providing a first person view. I want to make it so when the player moves the mouse, the player model is also rotated (yaw only). This is my current setup.

fX0nCgQ.png

If I attach that “Set Actor Rotation” node so it executes, it … kind of works. My character rotates ok, but there seems to be some stuttering as though it’s resisting movement. Also, this rotation is not replicated in a networked situation (Even if I go as far as to set it all up manually, setting the new rotation to a replicated variable, rotating the player actor on the server, executing a custom function that multicasts to to all clients using the replicated rotation variable).

Movement seems to be an area that’s pretty much managed by the editor. I don’t need to do any extra steps in order to get a character to move using WASD, simply apply a value to it’s “movement”. I’m thinking “Set actor rotation” is the wrong way to go about doing this, but I can’t seem to find another function I might use.

Any thoughts?

Which template do you use? Because something like that is already included in the character bp -> enable “use controller rotation yaw” :slight_smile:

What are you plugging into set actor rotation? If its anything other than event tick, it will be stuttering.

But that wont make it replicate properly. The reason is because the controller rotation doesnt replicate. You will need to get it locally, (with an RPC called on tick, set to execute on client) this event on client has to check to make sure it is the copy of the pawn that is locally controlled, use a branch, if the “is locally controlled” is true, after that branch, get the controllers rotation like you did above, now make another custom event RPC that executes on the server, and give it a variable called rotation or whatever, set type to rot, and plug in the result of your “make rot” node. Connect the second RPC you created (the one executing on server) to that set actor rotaion.

If you cant get it working I should be able to make a mock up and screenshot it this afternoon sometime.

I turned this on and it worked perfectly… thank you. The tutorial series I was following had me turn this off, but I didn’t think anything of it at the time. The series was for a third person game though so now it makes sense.

Thanks again!

This helped me a lot!