un1ND3X
(ice)
June 26, 2020, 8:20pm
#1
I’ve read this:
#CFrames are how ROBLOX represents the 3D position and orientation of objects in the game world.
Understanding how these work can lead to easier to write, easier to read, and overall more efficient CFrame code.
If you’ve ever done something like:
print(CFrame.new())
you know that it gives you 12 numbers. What do these numbers mean?
Well before we start, let’s think about CFrame.lookVector. lookVector is a unit vector (vector with a magnitude of 1) that points in the direction the CFrame is f…
but don’t understand how to move the camera in Studio towards its LookVector, I tried:
-- not new to CFrames, but never tried doing this before
local cam = workspace.Camera
cam.CFrame = CFrame.new((cam.CFrame.Position + cam.CFrame.LookVector) * 0.8)
This won’t work for all angles.
GregTame
(GregTame)
June 26, 2020, 8:56pm
#2
have you tried to just add the lookvector?
if you add a vector3 to a cframe, you translate it by world space.
cam.CFrame = cam.CFrame + (cam.CFrame.LookVector * 0.8)
1 Like
un1ND3X
(ice)
June 26, 2020, 8:58pm
#3
For some reason that makes the camera ‘flip’ when ran in succession, why?
GregTame
(GregTame)
June 26, 2020, 9:03pm
#4
I’m not sure.
have you set the camera type to scriptable?
Do you have any other code affecting the camera?
I just coded it up to check, and it’s working fine for me.
camera example.rbxl (17.9 KB)
2 Likes