generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Creating a Smoother Motion.

Previous Thread :: Next Thread 
Valone is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image