Download

This works, but just want to make sure there's not a better way to do this.

I have a pawn I rotate based on the user moving the mouse left or right. In my player controller I have this:

And in the pawn I have this:

It seems pretty straight forward, but just because it’s working, doesn’t mean there isn’t a better way of doing this. Since this is the first time I have tried to do this sort of thing, I just want to make sure I’m on the right path before I get too far.

Thanks!

You could probably cast to the pawn directly inside the controller and just set the actor rotation that way (or, better yet, use Add Local Rotation).

That way your Control Rot can be used for independent camera control down the line if you want.

whats wrong with a yaw input inside of your pawn? or is your pawn not a child of “character” ?
how about a “add rotation offset” instead of set actor rotation based on control rotation.
man that’s weird in so many ways. :smiley: what do you try to achieve exactly?

Everything is fine with input inside pawn, but moment you want different pawns in game you get mess.
When you want to have some keyboard bindings, you need to use event created in project settings.
When you have events you for eg can read state of “mouse X axis value” without doing that event.
So you can read mouse x and mouse y, put them together in single vector then use that to move, much less code in movement.

For eg my current setup:

  1. i read input axis here. All those boolean variables from key events, then i add some preprocess logic to it, for . eg if you crouch and start running i ignore crouch button and let player run. That is outside this function.

  1. then i send those values over to pawn and make move vector from axis values i read in function above

  1. last part is moving vector and rotating camera and pawn

45fde10fdae51327ec755a026c5a40b776f19548.png

Essentially it’s a cylinder mesh that is based off of a pawn class. I have the mesh offset 500 units from the pivot point and I’m using mouse to rotate this pawn class around that central pivot.

Essentially what I’m going to be doing is using the left and right mouse to rotate the pawn, and use the up and down to move the mesh in and out from the pivot point. I’m just trying to flush out the best way of doing this.

I don’t actually have a “Player Character”.

I’ve decided, for now to change things a little.

In my player controller I’m just doing this:

And in the pawn itself I’m doing this: (It takes care of both of my movements)

AddControllerYawInput is the method I use, just pass the delta rotation you want each frame, usually just a scalar * mouse axis.