Make pawn both move and rotate ingame

I have a pawn that I want to move left and right with the keyboard buttons “left” and “right”, and rotate it with “up” and “down”.
The issue I have is that when I rotate the pawn the pivot also rotates, so when I move the pawn to the left or right the movement is wrong.

For left-right movement I used addLocalOffset.
Tried addWorldRotation, addRelativeRotation, addLocalRotation for rotation.

Just out of curiosity, are you trying to make a rolling-ball character like in the example templates?

I’ve provided some screenshots to help you out with this, but you’re going to want to add the component “FloatingPawnMovement” or any of the other “Movement” components to the pawn.

352772-movementcomp.png

From there you’re going to want to setup Axis Mappings for the movement and rotation of the pawn.

352774-pawnaxismappings.png

Once that’s finished, for the movement input you’ll use “Add Movement Input” and use either Get Actor Right Vector, or Get Right Vector from the root component.
For the rotation, depending on whether or not you want the camera to rotate with the pawn use either “Add Controller Pitch Input” or “Set Actor Rotation” (Following the image below). Depending on where your camera is using the rotate actor only script you may have to find a work around once you rotate 90 degreees, but this should at least get you started.

No, I’m trying to make a ball-drop game where you move the pins in the board before the ball drops to make the ball fall in a specific hole at the bottom. So the pins need to be both moved and rotated :slight_smile:

Thank you for the tips!
Adjusted this a bit, but this kinda works like the code I had last time.
To add some more information about the game;
It is a vertical board with a ball at the top which is going to fall downwards. The player needs to place and rotate a pin (just one now at the beginning, will add more later) to get the ball to fall right into a specific hole. If the ball misses, the ball gets destroyed and resets.
So the pin needs to move along the x-axis (always relative to the board), and rotate to adjust the falling-angle to the ball.

This gives me the wanted functionality. Maybe there is a better way, I don’t know. Atleast it works.

I see what you’re looking for now.

But… is there some reason you need the peg to be the pawn?
Let it float as a lower component in the hierarchy and move it from the pawn.
You can even use constricts on all 3 angles on the pawn and still let the peg rotate.

I put together a really quick (and definitely messy) example project.
Pchink.zip

It has a movable component with no rotation as the pawn’s central component, and the peg follows it on a timer.
It’s not pretty but it should give you the idea.