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: Dynamic Distance

Previous Thread :: Next Thread 
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
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 is not online. 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
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
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 is not online. 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
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
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 is not online. 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 is not online. 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
bunnybunn263 is not online. bunnybunn263
Joined: 12 Sep 2007
Total Posts: 974
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 is not online. 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
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