i want the player to keep going straight when a script offsets the camera angle, no idea how i would do that
-- heres the code for the offset camera angle:
local humanoidroot = script.Parent:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
local runservice = game:GetService("RunService")
local function changeCFrame()
camera.CFrame = CFrame.new(humanoidroot.Position + Vector3.new(),root.Position --Change the cframe position
end
runservice:BindToRenderStep("Camera",3000,changeCFrame)
there is literally nothing in this script involving camera angles, dont use ai
um, camera.CFrame? Nothing in this script involves camera angles? CFrames hold both position and orientation.
did you even look at the script? only the position gets affected
Okay, it’s AI. Sorry. Is that what you wanted? I’M SORRY IM SORRY IM SORRY.
sorry for being passive-aggressive
It happens to the best of us. Or the worst…
i dont use ai this is only script i khow of
There’s a second argument passed which corresponds to a CFrame with altered rotation based on those two vectors.
no 2nd parenthesis in line 6 (fair since you’re a builder, not a scripter)
2 roots?? humanoidroot and just root, no variable for root
no idea why you would have “here’s the code for the offset camera angle” as a comment in the script
no, its just 2 vectors. .lookAt() is what you just mentioned, and it is nowhere in the script
if there is confusion on what i mean, take viewmodel animations. they have camera movement. i want that, but whenever i try making that, the player’s movedirection gets detoured towards the camera
Using the second argument does the exact same thing, just not as performant. They clearly passed a second argument.
never ever in my life have i used the 2nd argument
got the courage to actually test the script, its 100% ai. it requires manual fixing to get this result
bump, question still unanswered
The first reply had some truth to it, although the camera CFrame
has to be updated at two points: before player inputs are processed (0 - 99) and after player inputs (100+, desirably 200+ since priority of 100 - 199 causes jolting in camera when dragging it).
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local originalCFrame = camera.CFrame
-- Runs first before processing player input
local function BeforeInput()
camera.CFrame = originalCFrame
end
-- Runs after input processing (preferrably also after camera processing)
local function AfterInput()
-- Update the originalCFrame based on player changing camera by dragging
originalCFrame = camera.CFrame
-- Update camera CFrame to new desired CFrame
camera.CFrame = CFrame.new(camera.Focus.Position, Vector3.zero) -- Look at world center
end
RunService:BindToRenderStep("CameraDragging", 0, BeforeInput)
RunService:BindToRenderStep("CameraFinalCFrame", 200, AfterInput)
Basically before player inputs are processed, the camera gets placed into the previous CFrame
where the camera ended up due to player dragging it. Then once player inputs are processed, the new CFrame
the camera ended up in due to dragging gets saved. Afterwards the camera gets positioned to a desired CFrame
.