How to make camera that attached to torso go little higher [R6]

So I modified my camera (simple screen shake) and i wanted to make camera even more dynamic with attaching it to torso

It looks like this:
Screenshot_70

But it looks weird so i wanted to move camera Y axis little higher to make it look like default roblox camera:

(I hope yall see difference lol)

I tried to get it with changing CameraOffset like that, putting it in RenderStepped or outside didnt do any effect:

humanoid.CameraOffset = Vector3.new(0,10,0)

Allat in local script inside of StarterCharacterScripts

Code:

local runService = game:GetService("RunService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
local torso = character:WaitForChild("Torso")

camera.CameraSubject = torso

function updCameraShake()
	local currentTime = tick()
	local strength = nil
	
	if humanoid.WalkSpeed > 11 then
		strength = .065
	elseif humanoid.WalkSpeed <= 11 then
		strength = .03
	end
	
	if humanoid.MoveDirection.Magnitude > 0 then 
		local shakeX = math.cos(currentTime * 10) * strength
		local shakeY = math.abs(math.sin(currentTime * 10)) * strength
		local shake = Vector3.new(shakeX, shakeY, 0)

		humanoid.CameraOffset = humanoid.CameraOffset:lerp(shake, .25)
	else
		humanoid.CameraOffset = humanoid.CameraOffset * .7
	end
end

runService.RenderStepped:Connect(updCameraShake)

The CameraOffset property only offsets the camera if its subject if the Humanoid. When changing the CameraSubject to the Torso, the CameraOffset property won’t apply anymore.

To get your achieved effect, you might as well keep the CameraSubject to the Humanoid, and use solely CameraOffset to shake the camera. Alternatively, you could set the CameraSubject to the head and ignore offseting it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.