It’s kinda hard to explain this but I hope you can understand what I mean. So I’m trying to make a horror game that uses first person. I’m also adding flashlight for lighting. What I want is to make the mouse freely moves while the player is in first person so the flashlight will follow the player’s mouse. But I also want the camera to follows the player’s mouse as well, but a little bit delayed. Here’s a youtube video example of what I exactly mean. I hope you can help me out with this. Cheers!
You’d have to make a custom camera system for this.
What you can do is have a gui with the modal proprety set to true (idk if it should be true or false idr remember)
Detect if the mouse’s X and Y is Z distance away from the center and move the camera relative to the mouse in a circular movement
I don’t know if this is exactly what your looking for but here is a little test script I wrote real quick
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local CAMERA_OFFSET = Vector3.new(0, 1.5, 0)
local CAMERA_SPEED = 2
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local camera = Workspace.CurrentCamera
local character, humanoid
player.CharacterAdded:Connect(function(char)
character = char
humanoid = character:WaitForChild("Humanoid")
humanoid.CameraOffset = CAMERA_OFFSET
end)
RunService:BindToRenderStep("CameraScript", Enum.RenderPriority.Camera.Value, function(deltaTime)
if humanoid then
local targetCFrame = CFrame.new(character.PrimaryPart.Position + humanoid.CameraOffset, mouse.Hit.Position)
camera.CFrame = camera.CFrame:Lerp(targetCFrame, deltaTime * CAMERA_SPEED)
end
end)
You don’t need to mess with the camera. You can just make the flashlight move. You can calculate the speed at which the camera is moving, by getting the distance it moved from from X-1 to X. Then you apply some rotation to it, based on that speed.
yeah this is kinda what I want. But I want it to be a little bit delayed. So when the mouse is moved, It will wait about 0.1 seconds before moving the camera. I also want the camera to move smoothly. Should I use TweenService for that? Also the flashlight is done so no need to worry about it
Each TextButton and ImageButton have a “Modal” boolean propertie, which when enabled, make your mouse move freely even in first person view.
So all you have to do is to enable/disable this propertie on any of your current buttons in your PlayerGui.