|
| 12 Oct 2017 03:54 PM |
Is there a formula or an equation to work out how long it will take an object to reach a distance travelling at a certain velocity?
|
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 03:55 PM |
Oh its time = velocity / distance, but how do I use the velocity if its a Vector3?
|
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 03:55 PM |
d = rt
#code error("floodcheck blocked this post.") if humanoid.Health > 0 then post:Destroy end |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Oct 2017 04:03 PM |
that formula only works when acceleration is 0. If you don't care about the Y component then you can use it, otherwise you still have to account for gravity. |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 04:04 PM |
How would I do that?
This is for a gun if it helps. And the acceleration is 0. So can I divide a float by a vector3?
|
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 12 Oct 2017 04:15 PM |
| local part = script.Parent local part2 = workspace.yourPart local velocity = ################################################################################# local distance = (part.Position-part2.Position).magnitude local Time = velocity/distance this should work.. no? |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 12 Oct 2017 04:16 PM |
local part = script.Parent local part2 = workspace.yourPart local velocity = (math.abs (part.Vel ocity.X)+math.a bs(part.Velo city.Y)+mat h.abs(pa rt.Veloc ity.Z))/3 local distance = (part.Position-part2.Position).magnitude local Time = velocity/distance
this should work.. no?
--sorry u will have to remove spaces in the 'velocity =' section |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 12 Oct 2017 04:17 PM |
| My logic with velocity is; - Vector3 is speed in each direction, so to get speed, add all # ### ###### by 3. -- buuuuut you must make sure to add the absolute values because negative numbers will not work |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 12 Oct 2017 04:21 PM |
My logic with velocity is; - Vector3 is speed in each direction, so to get speed, a d d all and divide by 3. -- but you must make sure to add the absolute values because negative numbers will not work
--HOLY COW FILTER SO ANNOYING |
|
|
| Report Abuse |
|
|
crossbar
|
  |
| Joined: 08 Dec 2009 |
| Total Posts: 2817 |
|
|
| 12 Oct 2017 04:23 PM |
The formula for the displacement of an object with regards to acceleration is:
s=ut+1/2(a x t^2)
Where s is the displacement in meters t is the time taken (what you're looking for) u is the initial velocity and if you have acceleration then a is acceleration in m/s^2
So get the initial velocity of the object and its acceleration as well (average acceleration) and then solve for t. |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 04:24 PM |
hmm, it kinda did. but its very inaccurate
|
|
|
| Report Abuse |
|
|
|
| 12 Oct 2017 04:26 PM |
sorry, i dont understand that, there is no accelration (its moving at a constant speed)
Basically say I have 234 studs I'm moving at (4, 6, 3) how long would this take? this is the problem I have
|
|
|
| Report Abuse |
|
|
Quasiduck
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2437 |
|
|
| 12 Oct 2017 04:32 PM |
(4,6,3).magnitude = sqrt(61)
So it moves sqrt(61) studs a second in the same direction as (4,6,3).
234 studs / (sqrt(61)*studs/second) = 29.96 seconds.
This assumes that your velocity is constant and does not change. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 13 Oct 2017 04:53 PM |
Velocity = (|4|+|6|+|3|/3) = 4.333 studs/second
Time = 234/4.333 = 54 seconds
Hmm.. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 13 Oct 2017 04:54 PM |
| Are you sure magnitude is correct way to solve problem? |
|
|
| Report Abuse |
|
|
Quasiduck
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2437 |
|
|
| 13 Oct 2017 05:42 PM |
Yes.
Vector length is the shortest distance between the origin and the vector position.
e.g. Say you move forward (1,0,0) and then up (0,1,0)
That is the vector (1,1,0). However, it would have been quicker to just go diagonally to (1,1,0) which has a distance of sqrt(1^2 + 1^2) = sqrt(2) (by Pythagorean theorem).
I'm assuming of course that the 234 studs meant 234 studs away in the same direction that the object is travelling.
|
|
|
| Report Abuse |
|
|