#camera

1 messages · Page 1 of 1 (latest)

jade epoch
#
local camera = workspace.CurrentCamera
local cameraPart = workspace:WaitForChild("MainCamera")
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = nil
camera.CFrame = cameraPart.CFrame
``` anyone know how i would also reset the player's camera?
atomic atlas
#

make the cameratype Custom and the camerasubject be the player's character's humanoid

hollow ingot
atomic atlas
#

the subject is the humanoid by default

#

if you just set it to a part then you wont be able to go in first person correctly anymore n stuff

jade epoch
#

idk how to use Humanoid here

#

its a localscript in startergui

#

it just makes my mouse stuck in the middle

#

(i set the games default settings camera type to lockfirstperson)

atomic atlas
#

player.Character.Humanoid

jade epoch
# atomic atlas player.Character.Humanoid
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local player = Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    ui.Visible = false
    if player then

        camera.CameraType = Enum.CameraType.Custom
        camera.CameraSubject = player.Character.Humanoid 
    end
end)
``` my mouse just stays stuck in the middle still and my new camera isn't set
#

ok mouse is fine

#

its just the camera

#

as its first person so the mouse yeah

#
local mouse = game.Players.LocalPlayer:GetMouse()
local cam = workspace.CurrentCamera
local camPart = workspace:WaitForChild("MainCamera")

local Scale = 3000

cam.CameraType = Enum.CameraType.Scriptable

game:GetService("RunService").RenderStepped:Connect(function()
    local center = Vector2.new(cam.ViewportSize.X/2, cam.ViewportSize.Y/2)
    local x = mouse.X - center.X / 2
    local y = mouse.Y - center.Y / 2
    local xOffset = x/Scale 
    local yOffset = y/Scale

    local lookAtPoint = camPart.Position+camPart.CFrame.LookVector*5
    local vector = Vector3.new(
        lookAtPoint.X - xOffset,
        lookAtPoint.Y - yOffset,
        lookAtPoint.Z - xOffset)  

    local result = CFrame.lookAt(camPart.CFrame.Position,vector)

    cam.CFrame = result
end)
``` yeah i made a big mistake, i use this for camera
#

how would i revert to default camera?

jade epoch
#

bump