Hey guys. I’m making a top down shooter and my character won’t face the mouse correctly. The mouse icon isn’t aligned with the laser icon. When i move the mouse around in a circle, the distance from the laser to the mouse icon gets larger. It should actually stay the same length apart from each other.
Here is my script:
local function UpdateCam()
if Character then
if HumanoidRootPart then
local rootPosition = HumanoidRootPart.Position + Vector3.new(0, 20, 0)
local playerPosition = HumanoidRootPart.Position
CamController.Position = rootPosition
CamTurner.CFrame = CFrame.new(rootPosition, playerPosition)
Camera.CFrame = CamPart.CFrame
if not Sprinting then
Mouse.TargetFilter = workspace
local Direction = (Mouse.Hit.Position - Character["Right Arm"].Position).Unit
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, Vector3.new(Mouse.Hit.p.X, HumanoidRootPart.Position.Y, Mouse.Hit.p.Z))
end
end
end
end
RunService:BindToRenderStep("SidescrollingCamera", Enum.RenderPriority.Camera.Value + 1, UpdateCam)
What can i do to fix this? It might have somethign to do with the Mouse.Hit, but what other options do i have?