zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 10:37 AM |
I need some sort of math that will make the flak that shoots out of the cannon explode depending on the distance
the projecticle (the flak) is shooting out at the cannon's CFrame.lookVector * 600 , so i need an equation that will make it explode automatically when it comes relatively close, but keep in mind it is a TIMER, not when it detects the target close to it... if you would like me to elaborate on something, feel free to ask |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 10:46 AM |
To make more sense on the speed of the projectile, this is my line of code for the BodyVelocity inserted in it: local bv = Instance.new("BodyVelocity",ball) bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.Velocity = script.Parent.CFrame.lookVector * 600 |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 10:55 AM |
I'm confused as to what you want exactly. Speed/Distance = time The 'timer' would depend on how far you would like your projectile to attempt to travel before exploding. |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 10:57 AM |
| Let's say a random amount between 1-35 studs |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 10:59 AM |
God, I am so bad at explaining stuff. Sorry. I'll have a REAL explanation in a few minutes. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2016 11:02 AM |
Derp Distance/Speed = Time Time = Distance/Speed
Velocity is speed * direction In your case the lookVector is direction and the 600 is the speed
D = math.random(1,35) T = D/600 |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 11:03 AM |
Let's say there's the target is 500 studs from the cannon. The cannon shoots, the timer activates. The timer detects, when the cannon shoots, how much time it would take for the flak to explode when it gets into a random distance amount between to integers, in this case 1-35 studs. But keep in mind, it wouldn't explode when it gets from 1-35 studs from it, when it gets shot it does an equation to see how long it would TAKE for it to get from 1-35 studs of it, and explode when the timer reaches 0. But I'm not good at math, so I can't figure out an equation for that.
The projectile shoots at 600 speed with a BodyVelocity. |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 11:05 AM |
| I need it to explode in coordination with the flak cannon's position, so if I place it really close, the timer is shorter. Farther, the timer is longer. |
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 01 Sep 2016 11:08 AM |
What he gave you would work with a minor modification.
T = (distanceFromTarget - math.random(1, 35)) / 600
|
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
| |
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 11:34 AM |
| ###################################################################################### |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 11:35 AM |
| ############################################################################################ |
|
|
| Report Abuse |
|
|
zaniac10
|
  |
| Joined: 18 Aug 2009 |
| Total Posts: 10000 |
|
|
| 01 Sep 2016 11:36 AM |
| I'm so done with this new filter. Not even going to try to post it. Can figure it out myself. |
|
|
| Report Abuse |
|
|
badfitz60
|
  |
| Joined: 03 Sep 2010 |
| Total Posts: 1283 |
|
|
| 01 Sep 2016 11:39 AM |
put it into binary
All these questions have driven me into existential angst and I find myself beginning to question myself and my motives |
|
|
| Report Abuse |
|
|