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

How to move the Camera to Point A to Point B using a loop?

Asked by
Myaxp 3
10 years ago

I had an idea where I could use a GUI to move the camera around a menu screen. So when I press about, The camera would move towards the point where the about point would be. however I have no clue how to move the camera from point A to Point B. I know how to set them, just not move them. I do however have a feeling that I'm supposed to use loops to move the camera around. I have placed the GUI's down just not set them yet in the script, I do know how to set them. Here is what I have: (This is in a Local Script)

01local Menupos = workspace.Menu.PMenu.Position
02local Aboutpos = workspace.Menu.PAbout.Position
03local Playpos = workspace.Menu.PPlay.Position
04local Lookpos = workspace.Menu.LookC.Position
05 
06-------------------------//Main Script\\-------(There is where stuff happens!)-----------------------------------
07-----//Varialbes//
08 
09plr = game.Players.LocalPlayer
10cam = game.Workspace.CurrentCamera
11cam.CameraType = Enum.CameraType.Scriptable
12chr = nil
13 
14Menu = game.Workspace.Menu.PMenu
15About = game.Workspace.Menu.PAbout
View all 57 lines...

So would you need like a for loop to move the CoordinateFrame using +0.1 or something?

1 answer

Log in to vote
1
Answered by 10 years ago

Using loops is plausible, but it's very long and tedious, not to mention inefficient. Check out the Interpolate method of the camera. It basically tweens the camera to the position

You can set where the camera will be by the end of the interpolation, how long it'll take to do it, and where it'll end up looking at. It's a very smooth transition.

http://wiki.roblox.com/index.php?title=API:Class/Camera/Interpolate

Obviously you need to set the camera type to Scriptable.

Ad

Answer this question