So the short and sweet of it it that there is a Motor6D
connecting LowerTorso
and UpperTorso
. Motor6D
has a target CFrame
and i just ask the client what his camera’s LookVector
is and apply it to the target CFrame
of the Motor6D
. WELL COOL, works.
Now to the problem.
When i turn, the Motor6D
makes the rotation relative to the LowerTorso
.
See that the UpperTorso
doesn’t follow the camera correctly.
So things i tried:
-
Making
TargetAngle
face where theHumanoidRootPart
'sLookVector
is and from that i added the camera’sLookVector
. (might be the solution i just did it poorly ) -
Making the
Motor6D
… not aMotor6D
(just made the character loose his legs)
The code with the problem:
local waist = script.Parent:WaitForChild("UpperTorso"):WaitForChild("Waist")
local ans = script.Parent.CamAns
function answears(plr,look) --the problem is here
waist.C0 = CFrame.new(waist.C0.p, Vector3.new(math.floor(look.X* 100)/100,math.floor(look.Y * 100)/100,math.floor(look.Z * 100)/100))
end
ans.OnServerEvent:Connect(answears)
The code requires more things so here it is.
Turn.rbxl (18.9 KB)
Any help appreciated. Sorry for broken english .