cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 03 Dec 2013 09:18 PM |
I have this camera shaking function I found and used for my disaster script and I'm not sure how to make an apt way to find the duration of the camera shaking that correlates with the distance of the player... Does anyone have a good idea on how long a camera shake should last depending on the distance?
function shake.OnClientInvoke(distance) if shakes>5 then wait() shakes=0;return end coroutine.resume(coroutine.create(function() local steps=math.floor(math.ceil(time)*2) local freq=math.floor(distance/5+math.random(-1,math.pi)+math.random()) shakes=shakes+1 local cam = game:GetService("Workspace").CurrentCamera local time = math.abs(math.floor((math.pi+2)/distance)-(distance/3)) if (time<=0.6 or time>=6) then shakes=shakes-1;print(time);return end local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0) if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude) for i = 1, steps do cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude) game:GetService('RunService').Stepped:wait(time/steps) end shakes=shakes-1 end)) end
|
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 03 Dec 2013 09:27 PM |
| asdasd buuuuump why no anwerrrr ﴾͡๏̯͡๏﴿ |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 08:53 PM |
| dsdasdasdasd buuuuuuuuuuuuuuuuuuuump 9001 |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 08:55 PM |
| http://wiki.roblox.com/index.php/DistanceFromCharacter_(Method) |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 08:59 PM |
| ... that's not what I wanted... I already have distance from a character. Please read what I wrote... |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:06 PM |
| Umm, so what are you even asking for then? |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 09:07 PM |
| bump 900000000 WHY IS NO ONE HELPING ლ(ಠ_ಠლ) |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 09:07 PM |
| HERE:Does anyone have a good idea on how long a camera shake should last depending on the distance? |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:08 PM |
| Fine, I won't even try to help anymore. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:08 PM |
| Well isn't that personal preference... |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:11 PM |
| The farther away the longer it shakes, thats more realistic. |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 09:14 PM |
@secretidagent -_- I know that... I'm trying to find a way that makes it a good ratio between shake and time....
ex: time=distance/10--that works, but it's not very close to what would seem correct... ._. |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
| |
|
|
| 04 Dec 2013 09:16 PM |
Farther away from what? The center of an eartherquake? Then less shaking the farther away. (use distance formula/magnitude)
Or do you mean a lever? then greater shaking the father away. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:16 PM |
Jesus Christ, you bump every single minute.
Just mess around with different equations. |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 09:17 PM |
| @Jetta765214 yess.... I know how to get distance... howw would I make it so that it would be a apt ratio to use... like t=d/5 |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 09:28 PM |
bbbbb I already tried my own random equations, all of which sucked pretty bad... |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:31 PM |
| So how do you expect us to have the magical equation? |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:32 PM |
stop bumping so much(wait till at least your thread is off the first page).
Also, the formula doesnt matter much. The difference between them is so small, that it shouldn't matter.
Simplest way:
max_dis = 20
player1 = game.Players.Player1 point = Vector3.new()
shakes = (player1.Character.Torso.Position-point).mangitude < max_dis and (player1.Character.Torso.Position-point).mangitude or 0
Which would be hardly different the using a parabola to get the amount of shaking needed. |
|
|
| Report Abuse |
|
|
cxcharlie
|
  |
| Joined: 26 Aug 2009 |
| Total Posts: 1414 |
|
|
| 04 Dec 2013 10:24 PM |
| Ohh my.... I know how to get distance... nvm |
|
|
| Report Abuse |
|
|