Make a part stay in the center of the screen, DEADCENTER

Hi, im making a western game similar to RDR2 that relies on inverse kinematics to make it look nice
There is a target right now in the workspace that is supposed to be at the clients dead center of their screen, this would help the inverse kinematic point a gun properly.

My desired result:

What actually happens:

Code

local Part = workspace.Target
local Camera = workspace.CurrentCamera
local distance = 5 

game:GetService("RunService").Heartbeat:Connect(function()
	if Part ~= nil then
		Part.CFrame = Camera.CFrame * CFrame.new(Camera.CFrame.LookVector * distance)
	end
end)

Try doing this instead of using CFrame.new(), CFrame multiplication changes the axis into object space.

		Part.CFrame = Camera.CFrame + (Camera.CFrame.LookVector * distance)

hey you the ik guy i love ur work

also it worked thank you

is it possible when i finish the ik stuff i show it to you

1 Like

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