So I’m trying to achieve a camera delay effect similar to what you can see in the game Advanced Euphoria Ragdoll, as you can see here:
From what I can tell in the video, the camera offset seems to be constantly changing relative to the players velocity. I thought i could achieve this effect pretty simply by just doing that:
local camera = workspace.CurrentCamera
local humanoid = Character.Humanoid
while ragdolled do
humanoid.CameraOffset = -(Character.HumanoidRootPart.AssemblyLinearVelocity)/10
task.wait()
end
and this almost works:
It’s just, as you can see, the camera seems to be orbiting around the character, because the humanoidrootpart is rotating. This is due to how the ragdoll system I’m using works, where the humanoidrootpart is rotated along with the character. So I just need a workaround, possibly some way to account for velocity of the humanoidrootpart, just ignoring the orientation of it.
you could update the camera every frame and instead of moving it up/down relative to the humanoidRootPart, you can move it up/down relative to the global axis. Try using ToObjectSpace() and ToWorldSpace() to convert between global and local axis
Give this a try. I just convert the offset so instead of being relative to the world, it is relative to the HumanoidRootPart
local camera = workspace.CurrentCamera
local humanoid = Character.Humanoid
while ragdolled do
local offset = -(Character.HumanoidRootPart.AssemblyLinearVelocity)/10
local offsetRelativeToHRP = Character.HumanoidRootPart.CFrame.Rotation:ToObjectSpace(CFrame.new(offset))
humanoid.CameraOffset = offsetRelativeToHRP.Position
game:GetService("RunService").Heartbeat:Wait()
end