Valone
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 4371 |
|
|
| 09 Apr 2012 10:09 AM |
So, I got bored, and with the release of the Scriptable camera, I wrote this up.
wait(1)
function moveBetweenPoint(A,B) Frames = 30 local x0, y0, z0 = A:toEulerAnglesXYZ() local x1, y1, z1 = B:toEulerAnglesXYZ() local X, Y, Z = -(A.p.X-B.p.X)/Frames, -(A.p.Y-B.p.Y)/Frames, -(A.p.Z-B.p.Z)/Frames local CX, CY, CZ = -(x0-x1)/Frames, -(y0-y1)/Frames, -(z0-z1)/Frames for i = 1,Frames do Fram = CFrame.fromEulerAnglesXYZ(CX*i,CY*i,CZ*i) Vec = Vector3.new(X*i,Y*i,Z*i) Cam.CoordinateFrame = A*Fram+Vec Cam:SetRoll(CZ*i) wait() end end
Cam = game.Workspace.CurrentCamera
function runScene(Track) Cam.CameraType = Enum.CameraType.Scriptable for i = 1,#Track:GetChildren()-1 do moveBetweenPoint(Track[tostring(i)].CFrame,Track[tostring(i+1)].CFrame) end Cam.CameraType = Enum.CameraType.Custom end
runScene(game.Workspace.TrackB)
Unfortunatly, it's a little jumpy when on a new frame, and sometimes it angles slightly off.
Anybody know how to improve the math? |
|
|
| Report Abuse |
|