How to make player look to the mouse position?

So basically you can make your Character face the camera with R15 just like this using the Waist(Motor6d):
https://gyazo.com/066e702aa33a140e8c419ced225c7874

but I want to achieve something like this on R6 so how would I go about doing that?

Is there any Motor6d on the R6 Character that can do something like this?
If not then are there any alternatives?

I’ve seen a game achieve this: Weaponry.

If there’s a question like mines with a solution, please reply with the link :slight_smile:

1 Like

Yes there is motor6Ds in R6 character, like the motor6D that is below the R6 torso but To be honest it may look a bit weird when the body moves within the mouse for R6

Hi!

  • Sorry for my English I use translator*
    Hmm… Here there is a tiny problem - R6 do not have UpperTorso, which does not give them the opportunity to bend as well.

I only managed to create a small analog of this animation, but in my example, the entire player is leaning.robloxapp-20210329-1336076.wmv (2.6 MB)

 local Camera = workspace.CurrentCamera

 local Player = game.Players.LocalPlayer

 local Character = Player.Character

 local Root = Character:WaitForChild("HumanoidRootPart")

 local Neck = Root:FindFirstChildOfClass('Motor6D')

local YOffset = Neck.C0.Y

 local CFNew, CFAng = CFrame.new, CFrame.Angles

 local asin = math.asin

 game:GetService("RunService").RenderStepped:Connect(function()

 local CameraDirection = Root.CFrame:toObjectSpace(Camera.CFrame).lookVector

 if Neck then

 if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then

 Neck.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0)

 elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then

 Neck.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)

 end

 end

 end)

To prevent the player from levitating in the air, you can turn your feet towards the ground(this may seem difficult), but I see this as the only possible option.

I think that in the game that you showed us just turns the hands and head, unlike the animation R15, where the player’s torso turns. robloxapp-20210329-1357037.wmv (1013.2 KB)

4 Likes

Wow man thank you, I was searching for something cool like this thank you

1 Like