So all I’m trying to do is rotate the player’s character to follow the mouse. Currently it works, but if you were to move the cursor quickly, my method is not able to keep up. The character rotates just ever so slightly behind creatting a “choppy” effect.
You might be able to, but am not sure as I haven’t used AngularOrientation before.
Although BodyGyro works fine for me and pretty sure AngularOrientation requires Attachments
to be used. Probaly won’t get deprecated as it still has it’s uses tbh
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
local rs = game:GetService("RunService")
local ts = game:GetService("TweenService")
rs.RenderStepped:Connect(function()
local rx, ry, rz = camera.CFrame:ToOrientation()
local tween = ts:Create(hrp, TweenInfo.new(0.5), {["CFrame"] = CFrame.new(hrp.CFrame.Position) * CFrame.fromOrientation(0, ry, 0)})
tween:Play()
end)
Tweens are great for smooth animations/transitions.
local index = 0.2 --smoothness
RunService.RenderStepped:Connect(function()
local rx, ry, rz = CurrentCamera.CFrame:ToOrientation()
local final = CFrame.new(HumanoidRootPart.CFrame.Position) * CFrame.fromOrientation(0, ry, 0)
HumanoidRootPart.CFrame = HumanoidRootPart.CFrame:Lerp(final, index)
end)