How to rotate pawn using mouse in #UE4

I’m new to unreal engine and learning blueprint and basic stuff.
how can i rotate pawn using mouse .
what will be blueprint

Hey there @anonymous_user_dd7783e2! Welcome to the community! So it’ll vary pretty wildly depening on what type of character you have. If you’re working with a 3rd person or top down character, these 2 posts should get you started!

The blueprint:

Helpful adjustment in the comments:

If that’s not what you’re looking for, let me know!

1 Like

I bet this is how it looked like back in the day when Tim & the Team were designing the blueprints system. :love_letter:

4 Likes

This is of third person movement using mouse…!

i’m looking for solution of rotation of pawn using mouse #programming-scripting:blueprint

The question is too generic and vague and has a dozen answers. We don’t know how you want to rotate. It can be as easy as ticking a single box:

Or as complicated as you want to make it. If you want a very specific behaviour, you’d need to disclose more details. We don’t even know if you’re working with a template or designing stuff from scratch!


For a completely blank pawn, it could look like so:

2 Likes

That’s actually just for rotation assuming you were just trying to look at the mouse, ideal for 3rd person or top down characters you want to always look at the mouse. If you’re trying to turn a 3rd person player like in @Everynone’s example, you can use that code or take a look at the 3rd person template project.

i’m trying to
as play begin , player drag the object and rotate the object using the mouse …
how that can be implemented in blueprint…
i have written c++ code for it…
unable to attach here

how can i rotate pawn using mouse

vs

player drag the object and rotate the object using the mouse …

These seem to be 2 different things you’re asking about. Is this what you’re trying to do - inspect an object? As in:

1 Like

not to inspect an object.
first check the condition whether the mouse is press or not … then to select the object then as mouse changes its axis then same time the object rotate too…
want to implement this problem in blueprint

On Left click, get hit under cursor for objects, store reference, use the reference to add rotation using MouseX.


will this blueprint work

No. I’ll post an example in a bit.

1 Like

See if you can get it to work this way; hope I got it right.


You can validate the get node like so, btw:

I appreciate your time and for help…
one more question .
does not here play role of event tick function?

1 Like

Good question. MouseX polls every frame, just like Tick. If you ever create an AxisMapping, it will also work just like Tick - executing every frame:


If you scripted it like so:

The result would be identical but you’d need 5 nodes instead of 4. The horror! ;p

1 Like

@Everynone you are HERO…!
thnx for clarification

1 Like


what here GET part do?
is it like getting input of mouse and validating it?

I’m showing a picture of how to do it above. Alternatively you could:

image

But then we’re up to 6 nodes! :innocent:

1 Like

Yes but when searching blueprints this will be easily readable on the “Find” panel while a validated getter does not.

1 Like

Ah, bummer! Didn’t know that:

But, this seems to work OK:

image