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 » Scripting Helpers
Home Search
 

Re: Distance-->time?

Previous Thread :: Next Thread 
cxcharlie is not online. 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 is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
03 Dec 2013 09:20 PM
bummmp
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
03 Dec 2013 09:23 PM
asdiasdiapsd aspid
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
03 Dec 2013 09:27 PM
asdasd buuuuump why no anwerrrr ﴾͡๏̯͡๏﴿
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
03 Dec 2013 09:30 PM
wth... ლ(ಠ_ಠლ)(/゚Д゚)/
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
04 Dec 2013 08:53 PM
dsdasdasdasd buuuuuuuuuuuuuuuuuuuump 9001
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
04 Dec 2013 08:55 PM
http://wiki.roblox.com/index.php/DistanceFromCharacter_(Method)
Report Abuse
cxcharlie is not online. 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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
04 Dec 2013 09:06 PM
Umm, so what are you even asking for then?
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
04 Dec 2013 09:07 PM
bump 900000000 WHY IS NO ONE HELPING ლ(ಠ_ಠლ)
Report Abuse
cxcharlie is not online. 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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
04 Dec 2013 09:08 PM
Fine, I won't even try to help anymore.
Report Abuse
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
04 Dec 2013 09:08 PM
Well isn't that personal preference...
Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
04 Dec 2013 09:11 PM
The farther away the longer it shakes, thats more realistic.
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
04 Dec 2013 09:12 PM
-k... buuump
Report Abuse
cxcharlie is not online. 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 is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
04 Dec 2013 09:15 PM
b999999999999
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
04 Dec 2013 09:16 PM
Jesus Christ, you bump every single minute.

Just mess around with different equations.
Report Abuse
cxcharlie is not online. 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 is not online. 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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
04 Dec 2013 09:31 PM
So how do you expect us to have the magical equation?
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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