Trying to use mouse position to rotate pawns

Hello, I’ve been going at this for a few days now, but I’m thoroughly stumped. Can anyone give me some pointers on using the mouse position as a reference to rotate characters toward? Thanks in advance!

You can use “Find look at rotation”. It requires two inputs: Start (which should be the middle of the component you want to rotate) and Target (which should be the location of your mouse in world space which you can get via “Get Hit Result under Cursor”). Just plug those in and the result will be a rotator which you can directly use to rotate the component (or actor) of your choice.

Cheers! :slight_smile:

Thanks for the input mate, didn’t quite work though. Should I be putting this under the player controller blueprint? Here’s what I ended up with:

ok, I fiddled some more with it and the rotation works perfectly, but now whenever the actor moves it spazzes out and slows down the closer it gets to the mouse pointer.
This is the blueprint as it stands:

Sorry to be a bother, this is really bugging me out :confused:

1 Like

Well this looks almost perfect.

I assume you use “Simple Move to Location”.

Depending on what template you use “Control Rotation” shouldn’t be used. Your character tries to replicate it while also trying to move towards that point. So each frame two functions try to set this rotation and they might be different.

You really should only use a component to rotate and let the movement function handle the rotation of the actor itself.

Cheers.