I’m making a camera script that, when the player aims, faces their character to whatever direction the camera faces for the duration of them aiming. To do that, I repeatedly call this function:
--rotates root_part so that it's facing same direction as camera
--possibly use tween service to smooth this out :)
local function faceCharacterWithCamera()
local root_part : BasePart = (current_character.PrimaryPart :: BasePart).AssemblyRootPart :: BasePart
local root_part_position : Vector3 = root_part.CFrame.Position
local look_here : CFrame = current_camera.CFrame * CFrame.new(0,0,-10000)
local look_here_position : Vector3 = look_here.Position
root_part.CFrame = CFrame.lookAt(root_part_position, Vector3.new(look_here_position.X, root_part_position.Y, look_here_position.Z))
end
Currently, it’s tied to RunService.RenderStepped in a local script. I was just wondering if, with a server full of people playing, this would become very taxing and affect performance? If not, would adding Tweening so that the player’s character doesn’t just jump around affect performance?