Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Camera.CFrame is only changing the Z Value?

Asked by 6 years ago
Edited 6 years ago

For some reason it is only changing the Z-Value of my Camera not the X-Value that I am trying to change.

local increment = 0
local Camera = workspace.CurrentCamera
local focusPoint = workspace.Part


-- This is inside a function
Camera.CFrame = CFrame.new(focusPoint.Position + Vector3.new(increment, 0, 0))
increment = (increment + 12.5)
0
I'm new at this as well but try Camera.CFrame = CFrame.new(focusPoint.CFrame.lookVector*1 + Vector3.new(increment, 0, 0)) ICosmicReaver 32 — 6y
0
The Z value in your camera would be 'zoom in and zoom out' MooMooThalahlah 421 — 6y
0
Use `Camera.CameraType = Enum.CameraType.Scriptable` and see what happens. And put the LocalScript in StarterCharacterScripts MooMooThalahlah 421 — 6y
0
The changing to Enum really doesn't change anything but make it more stable. I need my camera to move to the right when I access this function YouSNICKER 131 — 6y
View all comments (5 more)
0
Did you try what I asked..? ICosmicReaver 32 — 6y
0
Yeah bro it didn't work man it does the same thing YouSNICKER 131 — 6y
0
Can you explain exactly what you're trying to accomplish? ICosmicReaver 32 — 6y
0
Well it's a local script and there's a gui button that you click and it brings the camera to the right aka the next item in a shop, so only the x-position of the camera is supposed to move but it zooms out only. Basically doing the camera system for the shop that Mining Simulator and other games have. YouSNICKER 131 — 6y
0
Ok I understand posting answer ICosmicReaver 32 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Haven't tested this but if theres any errors you can probably figure it out.

wait(2)
local increment = 0
local Camera = workspace.CurrentCamera
Camera.CameraType = 'Scriptable' -- This needs to be set to scriptable because roblox default camera doesn't let you change CFrrame
local focusPoint = workspace.Part

offset = focusPoint.CFrame.lookVector*-20 -- places 20 in front of part

Camera.CFrame = focusPoint.CFrame+offset


wait(2)

increment = (increment + 12.5)
-- This is inside a function
Camera:Interpolate(focusPoint.CFrame + Vector3.new(increment, 0, 0)+offset,focusPoint.CFrame,2) -- represents pan time

-- also instead of using increments, use a new focuspoint so that the angle changes as well

Ad

Answer this question