|
| 11 Oct 2013 04:50 PM |
| How is it possible to detect the rate of change within the distance of two objects without using wait()? |
|
|
| Report Abuse |
|
|
lupine
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 3561 |
|
|
| 11 Oct 2013 04:55 PM |
Why without wait?
You could use the Changed event |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2013 04:59 PM |
| I'm making a deflection shooter, so it can only use a set of data from one point in time to estimate where it will shoot. |
|
|
| Report Abuse |
|
|
lupine
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 3561 |
|
|
| 11 Oct 2013 05:08 PM |
Will this work?
_G.refl = function(all, your, variables, go, here) --stuff end
while wait(1) do _G.refl(do, this, cool, thing, now) end
I'm not entirely sure what your problem is? |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2013 05:15 PM |
Well, okay.
I am leading the shot, I suppose you could say.
I have the speed of the bullet, the speed of the target, the distance between the cannon and the target, and all that stuff.
The equation is the target position+target velocity*distance/bullet speed to find the position to shoot at.
It works quite wonderfully.
My problem is the distance is not always consistent. The distance could change if the target moves away from/towards the cannon, which throws a wrench in the prediction.
What I need to do is calculate what the distance will be based on the velocity of the target. |
|
|
| Report Abuse |
|
|
lupine
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 3561 |
|
|
| 11 Oct 2013 05:31 PM |
Ohhhhh, I get what you're saying.
Let me try 'n help you.
So I'm assuming you're using some sort of function that will shoot this at an OBJECT (as opposed to a position), using Mouse.Target as opposed to mouse.Hit With that, you can do:
local mouse = game.Players.LocalPlayer:GetMouse() -- I'm guessing local targ = mouse.Target
PosToShoot = target.Position + (target.Torso.Velocity*distance/bullet speed)
Is that what you're needing? The velocity MAY change though, and there's an easier way to do this if you want it to track it's target mid flight |
|
|
| Report Abuse |
|
|
lupine
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 3561 |
|
|
| 11 Oct 2013 05:32 PM |
| Whoops, remove the '.Torso' in the equation line and you're golden |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2013 06:31 PM |
Well, not really.
I've gotten it figured out on my own. The turret that fires upon me, however, is controlled by bodygyro. The delay in bodygyro really messes up the aim in very distant shots. How could I fix that? |
|
|
| Report Abuse |
|
|
chaokid9
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 6187 |
|
|
| 11 Oct 2013 06:36 PM |
| I'm a bit confused by your question, possibly because I don't know what a deflection shooter is, but what does it currently do when fired and what do you want it to do when fired? |
|
|
| Report Abuse |
|
|