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
 

Math

Previous Thread :: Next Thread 
Aurarus is not online. Aurarus
Joined: 22 Dec 2008
Total Posts: 4761
01 Jan 2013 04:32 AM
Say I have an iterator counting up to 15.

I want to make the FOV of a character grow up to 80 in a smooth manner (Starts out moving fast, and slowly goes into 80) from 70, the default camera FOV.


And then afterwards, another iterator counting up to 20 to smoothly put the camera FOV back down to 70.

I'm bad with math, so I don't know a good way to do the smoothing. (Or the slowly growing acceleration, or whatever)
Report Abuse
TeamDman is not online. TeamDman
Joined: 04 Dec 2009
Total Posts: 897
01 Jan 2013 08:17 AM
-- I have NO idea if the below code will work at all.
local Camera = workspace.CurrentCamera
local Current = 70*1.5
repeat
wait()
Current = Current/1.5
Camera.FieldOfView = Current
until Camera.FieldOfView >= 80
wait(1)
for i=Camera.FieldOfView,20,-0.5 do
wait()
Camera.FieldOfView = i
end


--*Counting down to 20 from 70
--§TeamDman§ Anti-Jared
Report Abuse
ThePC8110 is not online. ThePC8110
Joined: 04 Jun 2011
Total Posts: 486
01 Jan 2013 08:23 AM
I don't get what you're saying but:

local inc,start,time,end = .1, 20, .001, 70
down = false
inc = (down and -inc or inc)
for i = start,end,inc do
wait(time)
Workspace.CurrentCamera.FieldOfView = i
end
Report Abuse
ThePC8110 is not online. ThePC8110
Joined: 04 Jun 2011
Total Posts: 486
01 Jan 2013 08:27 AM
Ohh ok. Here:

local inc,start,time,end = .1, 20, .001, 70
down = false
inc = (down and -inc or inc)
for i = start,end,inc do
inc = inc + (down and -.005 or .005)
wait(time)
Workspace.CurrentCamera.FieldOfView = i
end

Should work.
Report Abuse
gijsbel11 is not online. gijsbel11
Joined: 07 Feb 2009
Total Posts: 4223
01 Jan 2013 10:31 AM
I think he doesn't want a constant iteration, but a smooth iteration..

http://
en.wikipedia.org/
wiki/
Smoothstep
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
01 Jan 2013 10:35 AM
0 <= iterator <= 15
FOV = 70 + math.sin(iterator * math.pi / 30) * 10


20 >= iterator >= 0
FOV = 80 - math.sin(iterator * math.pi / 40) * 10


Just imagine a graph which starts and 0 and goes to 10, then add an offset. The graph of sine along the x axis from 0 to pi/2 eases into its maximum.
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