Jump to content
  • Advertisement
Sign in to follow this  
newtomaths

targeting with drag

This topic is 3800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

given the equation of motion: x1 = x0 + v0 * t + 0.5 * a * t * t i can solve for an initial velocity to hit a target at x1. but this is contingent on constant acceleration. how would i solve for an initial velocity given a drag force as it changes relative to velocity? to be even more specific, i'd like the projectile to "land" or stop at x1. all of my ideas so far seem less than desirable- surely there's a tidy way of handling this... thanks for any help!

Share this post


Link to post
Share on other sites
Advertisement
It depends on the exact form of drag that you are thinking of using, but chances are you won't be able to describe the trajectories with simple formulas, so you'll have to resort to numerical methods.

Share this post


Link to post
Share on other sites
thanks for the reply!

i was hoping to use:
-velocity * dragCoeff
i guess i anticipated having to use numerical methods- do you have any suggestions keeping efficiency in mind?

Share this post


Link to post
Share on other sites
In that case, I think you can solve your problem analytically, since the motion obbeys a classic linear differential equation. I'll give it a try tonight.

Share this post


Link to post
Share on other sites
I think I get this:
v0 = (x1 - x0) * dragCoeff

It will take an infinitely long time to stop, though.

Share this post


Link to post
Share on other sites
Quote:
Original post by newtomaths
To be even more specific, i'd like the projectile to "land" or stop at x1. all of my ideas so far seem less than desirable- surely there's a tidy way of handling this...
Deceleration?

Here's the image I get: An object is moving at some speed, and slows down until it stops at some location. If this were all that we want, then we are just watching an object accelerate from a starting point in reversed time. It would probably make more sense to use a negative acceleration though.

But if we want a starting velocity to first accellerate, then decelerate, something more. Maybe swing the acceleration/deceleration number through a half-circle (or some other curve), where x is time and y is acceleration.

[Edited by - AngleWyrm on July 11, 2008 2:16:39 AM]

Share this post


Link to post
Share on other sites
The problem doesn't seem to be clear enough. The problem I solved above is the following: You have an object moving in a fluid, which experiments a drag force that is proportional to its speed. How fast does it have to be going initially when it is at x0 if you want it to stop at x1?

The acceleration and the velocity obbey the following equation:
a(t) = -dragCoeff * v(t)

Since the acceleration is the derivative of the velocity, we have the following differential equation:
d(v(t))/dt = -dragCoeff * v(t)

The solutions are of the form
v(t) = v0 * exp(-dragCoeff * t)

Integrating the formula above, we get
x(t) = - (v0 / dragCoeff) * exp(-dragCoeff * t) + C

We know that x(0) = x0, so
x0 = -(v0 / dragCoeff) * exp(-dragCoeff * 0) + C
x0 = -v0 / dragCoeff + C
C = x0 + v0 / dragCoeff

We also know that as t goes to infinity, x(t) should go to x1, so
x1 = -(v0 / dragCoeff) * exp(-dragCoeff * "Infinity") + x0 + v0 / dragCoeff
x1 = x0 + v0 / dragCoeff
v0 = (x1 - x0) * dragCoeff

I hope that is clear enough.

If this is not the problem the OP was trying to solve, he should post a more clear description of the problem.

Share this post


Link to post
Share on other sites
ok, so that worked well. unfortunately, it brought to light that i need to actually supply an amount of time, and solve for the drag coefficient. any ideas?

Share this post


Link to post
Share on other sites
If you followed the equations I posted, you can easily compute anything you want about this problem, since the complete equations as a function of time are spelled out. If you can't figure it out, post a more precise description of your new problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!