After messing around with it I gave up and went back to BodyGyro
, it had better results.
So right now the character does indeed tilt:
Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if not Character.HumanoidRootPart:FindFirstChild("BodyGyro") then
local newGyro = Instance.new("BodyGyro")
newGyro.D = 250
newGyro.P = 6000
newGyro.Parent = Character.HumanoidRootPart
else
local Direction = Character.HumanoidRootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection)
Character.HumanoidRootPart.BodyGyro.CFrame = CFrame.new(Character.HumanoidRootPart.Position, Direction)
end
end)
The only issue is MoveDirection
is in WorldSpace
which is not relative to the character meaning…
https://gyazo.com/be75f8a220e85b8c6d1eafb9a6b38d15
So to fully finish this, I’d need to know how to get the MoveDirection
relative to the player.
I’ve done some research and found 2 related links:
Both state that you must use VectorToObjectSpace
but I do not understand how to use them. If anyone is experienced with VectorToObjectSpace it’d be amazing if you could reply. I’ve tried:
Character.HumanoidRootPart.CFrame:VectorToObjectSpace(Direction)
But was unable to get any new results.