#R6 Left Shoulder point to Mouse

1 messages · Page 1 of 1 (latest)

loud sphinx
#

Everything I've tried hasn't worked, I need help..

wooden perch
#

are you trying to make the player point their arm at the mouse?

wooden perch
#

have you gotten anything to work or somewhat work yet?

loud sphinx
#

Then again I was using Cframe.Lookat

wooden perch
#

I think you can do it by modifying the target angles of the Motor6Ds in the character

#

i'll figure out which one rq

#

I'll switch to R6 to make sure

loud sphinx
#

It's called Left Shoulder, and it's a child of Torso

wooden perch
#

yeah i was testing and it doesnt look like its letting me change the current angle

#

it worked on R15 but not R6 ill see if i can figure out why

loud sphinx
wooden perch
#

oh i figured out how to do it i think

#

you have to change the orientation of the C0 and C1 properties

loud sphinx
#

I know, I just don't know how to make it follow the mouse

wooden perch
#

so maybe something like this?

local function toDeg(rad) return rad*180/math.pi end
local rx,ry,rz = CFrame.lookAt(workspace.CurrentCamera.CFrame.Position, Mouse.Hit.Position):ToOrientation()
LeftShoulder.C0 = CFrame.new(LeftShoulder.C0.Position) * CFrame.fromOrientation(toDeg(rx),toDeg(ry),toDeg(rz))
#

in runservice loop

loud sphinx
#

Whars with the camera?

midnight tideBOT
#

studio** You are now Level 6! **studio

wooden perch
#

oh yeah it should probably be your players position

loud sphinx
#

Ohkay

#

Ill try it tommorow

#

Thank you 👍

wooden perch
#

ok, the code i sent didnt work exactly but i should be able to get it working ill send once i find a working solution

#

you're welcome

wooden perch
#

ok i got it working this is probably a terrible solution cause i dont know how cframes work lol

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local LeftShoulder = script.Parent:WaitForChild("Torso"):WaitForChild("Left Shoulder")

RunService.RenderStepped:Connect(function()
    local x1,y1,z1 = LocalPlayer.Character.PrimaryPart.CFrame:ToOrientation()
    local rx,ry,rz = CFrame.lookAt(LocalPlayer.Character.PrimaryPart.Position, Mouse.Hit.Position):ToOrientation()
    LeftShoulder.C1 = CFrame.new(LeftShoulder.C1.Position) * CFrame.fromAxisAngle(Vector3.new(0,-1,0), -math.pi/2) * CFrame.fromEulerAnglesXYZ(-rx - math.pi/2,-ry - math.pi/2, 0)  * CFrame.fromOrientation(x1,y1,z1)
end)
#

and you will probably need to play an animation that keeps the left arm still so walking and stuff doesnt affect the pointing