Advertisement

x^2-curve

Started by February 28, 2000 10:01 AM
3 comments, last by Jimbo 24 years, 6 months ago
A short question - how do get a pixel to travel in a x^2 curve?
You get the velocity by deriving the formula:

Position
F(x) = x2

Speed
dF(x) = 2x

Acceleration
ddF(x) = 2

But if you want to do a ballistic course of a shell you might consider something like this:

Fire location
Pos = (x,y)

Fire speed
Spd = (dx, dy)

Then you move the shell iteratively by this algorithm


  1. Update location
    Pos = Pos + t*Spd;
  2. If collision then exit loop
  3. Update speed
    Spd.dy += t*GravityConst;
    Spd.dx += t*Wind;
  4. Goto 1


Edited by - Spellbound on 2/28/00 10:26:14 AM

I have corrected the error that webspynner_99 mentions below.

Edited by - Spellbound on 3/1/00 6:41:22 AM
Advertisement
That works great! Thanks!!
Actually if F(x)=x^2, then F''(x)=2x and F''''(x)=2 not 0 as spellbound had said.
Oops...

This topic is closed to new replies.

Advertisement