#Camera Shananigans

73 messages · Page 1 of 1 (latest)

unkempt kelp
#

Why not just hire them or ask them to make your entire game?

scenic granite
#

@pliant basalt

#

The camera

#

Moves like shit

#

I think it's because of CFrames

pliant basalt
#

What the hell are you doing in that first function?

scenic granite
#

So

#

I make sure the position is the right 1

#

It's a cutscene of sort

pliant basalt
#

Well as I’m on mobile and cooking at the same time I can’t quite fix the entire code but try to use tweens normally

#

You can do a lot with tweens and renderstep loops

scenic granite
#

I tried for 4 hours to fix it. Right now I am doing something else in unity

unique field
#

who pinged me again

mighty ridge
#

Could you post script here with the code block style i am on mobile

scenic granite
#

Script too big

#

Go on github

mighty ridge
scenic granite
mighty ridge
#

I mean i am a GitHub enjoyer so I guess I will

scenic granite
mighty ridge
#

My phone nearly imploded

#

Anyways what is the issue with the script

#

@scenic granite

unique field
scenic granite
scenic granite
unique field
scenic granite
#

Just a question

#

Can we talk in DM's?

unique field
#

sure

scenic granite
#

Btw @unique field apparently you changed this ```lualocal function startcampos()
Camera.CameraType = Enum.CameraType.Scriptable

local targetPosition = Vector3.new(78.066, 7.212, 5.476)
local targetOrientation = Vector3.new(-2.402, -89.24, -0)

local function pointCamera(position, orientation)
    Camera.CFrame = CFrame.new(position, position + orientation)
end

local cameraOrientation = calculateOrientation(Camera.CFrame.Position, targetPosition)
pointCamera(targetPosition, cameraOrientation * CFrame.Angles(math.rad(targetOrientation.x), math.rad(targetOrientation.y), math.rad(targetOrientation.z)).lookVector)

end``` quite much and now the camera doesn't go there at the beggining of the trigger

#

Implemented it just now, everything works just this

unique field
#

oh yeah. I'm sorry about that.

scenic granite
#

It's quite an important part. Because the camera isn't in the right place at the beginning

scenic granite
#

Please, help me fix it?

mighty ridge
#

im on pc

scenic granite
#

@mighty ridge If your on pc and know with CFrames please integrate this bit ```lua
local function startcampos()
Camera.CameraType = Enum.CameraType.Scriptable

local targetPosition = Vector3.new(78.066, 7.212, 5.476)
local targetOrientation = Vector3.new(-2.402, -89.24, -0)

local function pointCamera(position, orientation)
    Camera.CFrame = CFrame.new(position, position + orientation)
end

local cameraOrientation = calculateOrientation(Camera.CFrame.Position, targetPosition)
pointCamera(targetPosition, cameraOrientation * CFrame.Angles(math.rad(targetOrientation.x), math.rad(targetOrientation.y), math.rad(targetOrientation.z)).lookVector)

end ```
with the script ScriptedInterface sent

#

I tried but it always doesn't work

#

toughts?

mighty ridge
scenic granite
#

You can put it in studio, it's pretty hard to explain it

#

basicly it doesn't tween if i add this bit

scenic granite
#

But add it in studio cuz its hard to fix

unique field
unique field
#

So you want the camera to go there on the spot when the player interacts with the prompt?

scenic granite
#

Yeah so when the proxy prompt is triggered the cam goes there. and from there it tweens to those numbers

unique field
#

Not when the prompt trigger is finished?

scenic granite
unique field
#

alr

#

I understood.

scenic granite
#

By the way

#

You know how to be eligible for immersive ads?

unique field
scenic granite
#

Yeah but I got issues with the camera not really the trigger it works ok

#

Just this bit```lua
local function startcampos()
Camera.CameraType = Enum.CameraType.Scriptable

local targetPosition = Vector3.new(78.066, 7.212, 5.476)
local targetOrientation = Vector3.new(-2.402, -89.24, -0)

local function pointCamera(position, orientation)
    Camera.CFrame = CFrame.new(position, position + orientation)
end

local cameraOrientation = calculateOrientation(Camera.CFrame.Position, targetPosition)
pointCamera(targetPosition, cameraOrientation * CFrame.Angles(math.rad(targetOrientation.x), math.rad(targetOrientation.y), math.rad(targetOrientation.z)).lookVector)

end ``` needs somehow to be integrated with the 1 you sent to me

scenic granite
#

It worked but messed up the intial cam pos

#
local function startcampos()
    Camera.CameraType = Enum.CameraType.Custom
    local targetPosition = Vector3.new(78.066, 7.212, 5.476)
    local targetOrientation = Vector3.new(-2.402, -89.24, -0)
    moveCameraTarget(targetPosition, targetOrientation)
end
``` tried to modify this but idk why it won't work
#

This is how you modified it and the one I sent you is how it supposed to be, since you made the script, toughts?

unique field
#

let me go to github again

scenic granite
#

Ok

rare beaconBOT
#

studio** You are now Level 8! **studio

unique field
#
local Camera = game.Workspace.CurrentCamera
local proxy = game.Workspace.FinishDemo.ProximityPrompt
local CameraTarget = Instance.new("Part")
CameraTarget.Name = "CameraTarget"
CameraTarget.Anchored = true
CameraTarget.CanCollide = false
CameraTarget.Transparency = 1
CameraTarget.Parent = game.Workspace

local function moveCameraTarget(position, orientation)
    CameraTarget.CFrame = CFrame.new(position) * CFrame.Angles(math.rad(orientation.x), math.rad(orientation.y), math.rad(orientation.z))
    Camera.CameraSubject = CameraTarget
end

local function startcampos()
    Camera.CameraType = Enum.CameraType.Custom
    local targetPosition = Vector3.new(78.066, 7.212, 5.476)
    local targetOrientation = Vector3.new(-2.402, -89.24, -0)
    moveCameraTarget(targetPosition, targetOrientation)
end

local RunService = game:GetService("RunService")

local function tweenCamera(position, orientation, duration)
    local initialPosition = Camera.CFrame.Position
    local initialOrientation = (position - initialPosition).unit

    local startTime = os.clock()
    local endTime = startTime + duration

    local function updateCamera()
        local currentTime = os.clock()
        local timeFraction = (currentTime - startTime) / duration

        if timeFraction >= 1 then
            moveCameraTarget(position, orientation)
            RunService:UnbindFromRenderStep("CameraTween")
        else
            local newPosition = initialPosition + (position - initialPosition) * timeFraction
            local newOrientation = initialOrientation:Lerp(orientation, timeFraction)

            moveCameraTarget(newPosition, newOrientation)
        end
    end

    RunService:BindToRenderStep("CameraTween", Enum.RenderPriority.Camera.Value, updateCamera)
end

proxy.Triggered:Connect(function()
    startcampos()
    wait(0.5)
    tweenCamera(Vector3.new(44.69, 93.795, 6.245), Vector3.new(-8.687, -69.63, 0), 4)
end)
scenic granite
#

Thanks

#

@unique field , sorry for ping but you know how to disable the player from moving the camera?

unique field
#

I don't know about that one. Sorry man.

rare beaconBOT
#

studio** You are now Level 19! **studio

unique field
#

I got to go now.