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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|