Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would one Lerp at LookAt CFrame?

So basically i'm trying to rotate a character smoothly at a certain position would i need a body gyro?

i have tried using

CFrame:lerp()

but that does not seem to work another person asked this question 5 months ago but nobody answered him; one said they couldn't interpret what he was asking

2 comments

0

yeah me too

0

but at least i can interpret

1 answer

ur

CFrame:Lerp()

wont work cus (im assuming) its the way u set it up. I would presume that u did something that fixed the root's CFrame for a period of time, meaning, that, for that period of time the root wont accept any motion inputs from the player, deadlocking it.

if u understand what i mean so far, we would need to do the opposite of that, and make the updates spontaneous(supposedly within a loop) such that the player will still be able to move the character; something like the below:

place in StarterPack:

local delay = .4 -- amt of time u want to delay

local cam = workspace.CurrentCamera
local root = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild("HumanoidRootPart")

game:GetService("RunService").RenderStepped:Connect(function()
	local dir = (root.CFrame:Inverse() * cam.CFrame).LookVector
	
	root.CFrame = root.CFrame:Lerp(root.CFrame * CFrame.Angles(0, -math.asin(dir.X), 0), 1 - delay)
end)

or idk perhaps something went wrong with ur operation on the CFrame

2 comments

0

but yeah best way would be to use the BodyGyro but thats the easy way out

0

that didnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.