How could I make the players charachter point towards the players mouse?

Basically what the title says. I just started making an isometric style RPG. Here is what the camera system looks like so far:

https://gyazo.com/ab75d5e9a6baeb7eadd75ac525fc089d

So yeah I was wondering how I could make the player’s character point towards the mouse’s position at all times. If anyone can help me with this, I would appreciate it.

1 Like

If you type ‘Make character face mouse’ in the Search tab up top there are quite a few threads.

From the Mouse.Hit’s position, you can find the direction for the player to look by getting the difference vector of the two from the player’s Position, then you can use lookAt this function is on the wiki page of the documentation of CFrame.fromMatrix on the CFrame page or CFrame.new(position, look) to make the player look at the position:

local dir = (Mouse.Hit.Position - HumanoidRootPart.Position).Unit -- getting the vector as a unit vector to obtain its direction
dir = dir * Vector3.new(1, 0, 1) -- with the Y-component taken into account, the player will tilt up and down to face the height of the position
-- (cont'd) We don't want that, so we'll project the vector onto the XZ plane by setting the y-component to 0

HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, HumanoidRootPart.Position + dir)
-- adding the direction onto their current position to face the mouse's position
3 Likes