What do you want to achieve?
I’m trying to make a first person POV that is in sync with the torso so that the torso doesn’t move infront of the camera.
What is the issue?
When the player walks forward, due to a tilting effect the torso will move slightly infront of the camera, and this is way more noticeable when the player is sprinting because the torso comes into full frame. I’d like for the camera to stay in the same perspective seen when the player isn’t moving at all. https://www.youtube.com/watch?v=32PbpEGeYhk
What solutions have you tried so far?
I’ve attempted to use bindable events that communicate when the player is sprinting to offset the camera a bit forwards but that isn’t nearly as smooth as I’d like it to be especially considering the tilt effect is not an instant motion and is instead a slow transition.
I’m not sure how I can go about keeping the camera in line with the torso. Any suggestions or help is greatly appreciated.
the camera offset is changed, nothing else is altered
RunService.RenderStepped:Connect(function()
local isFirstPerson = (camera.CFrame.Position - head.Position).Magnitude < 1.6
if isFirstPerson then
humanoid.CameraOffset = Vector3.new(0, 0, -1)
applyShadowHack()
else
humanoid.CameraOffset = Vector3.new(0, 0, 0)
revertShadowHack()
end
for _, part in character:GetChildren() do
if part:IsA("BasePart") and part ~= head then
part.LocalTransparencyModifier = isFirstPerson and 0 or 0
end
end
end)
Run UserInputService:IsKeyDown(Enum.Keycode.W) and if thats true, have it make the offset -2. I’d also lerp it so it feels smooth and slightly increase FOV to mask the effect.
Method 2 (dont recommend but can use)
get the AssembyLinearVelocity of the player’s HumanoidRootPart, then run local RelativeVelocity = Character.HumanoidRootPart.CFrame:VectorToObjectSpace(AssembyLinearVelocity), and check if RelativeVelocity.Z is negative. If it is, it means they’re going forward, and then thats your check to again lerp the offset to -2.