Hello! I’m working on making the characters upper torso rotate towards the mouse hit position. My current solution for this is the following:
Instantiate a part and weld it to the UpperTorso, rotate the Waist’s C0 to match the our new part. The new part is using CFrame.lookAt to face mouse hit position. It seems to work fine in an empty workspace however as soon as I implement it into the real game the collisions begin to bug out. I made sure collisions on everything attached to the player and even all the parts of the character were disabled.
It definitely feels like something is colliding when you look down or up, but collisions are disabled for the whole character so it doesn’t make sense that something could be colliding.
Here’s my code:
local ro = char:WaitForChild("HumanoidRootPart")
local UpperTorso = char:WaitForChild("UpperTorso")
local AP = game.ReplicatedStorage.Spawnables.AnchorPoint:Clone()
AP.Parent = char
AP.Position = UpperTorso.Position
local weld = Instance.new("Weld")
weld.Part0 = UpperTorso
weld.Part1 = AP
weld.Parent = UpperTorso
RUS.RenderStepped:Connect(function()
if wpn.Value == "Rifle" then
sPart.CFrame = char.RightHand.Rifle.flashPart.CFrame
game.ReplicatedStorage.Remotes.updatePos:FireServer(sPart.CFrame,char.RightHand.Rifle.flashPart.CFrame)
if aiming == true or shooting == true then
game.ReplicatedStorage.Remotes.setup:FireServer()
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
ro.CFrame = CFrame.new(ro.Position) * CFrame.Angles(0,y,0)
AP.CFrame = CFrame.lookAt(UpperTorso.Position,mouse.Hit.Position)
local X = math.clamp(math.rad(AP.Orientation.X),-90,90)
local Y = math.clamp(math.rad(AP.Orientation.Y),0,0)
local Z = math.clamp(math.rad(AP.Orientation.Z),-90,90)
--print("X"..X.." Y"..Y.." Z"..Z)
UpperTorso.Waist.C0 = CFrame.Angles(X,Y,Z)
end
end
end)
And here’s a video showing off the issue:
Any and all help is appreciated!