Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

3d ellipse given two points

  1. Jul 1, 2010 #1
    i'm having trouble creating a arc for check for collision similar to a grenade launcher type weapon and am not very good at math :/

    i have the player position and the target position, now i just need to check every so often (let's say .1 units) along the outside of my ellipse to see if my raycast has struck geometry.

    so i have the 2 vector3's of position, and want the ellipse to scale on the Y axis based on the distance between them. some of it i can figure out but just don't know math well enough.

    can someone cast some light on the formula i might use? basically just looking for an array of all the points on an ellipse every .1 units
     
  2. jcsd
  3. Jul 3, 2010 #2
    Hi. Is it a problem of faking ballistic trajectories?

    http://img193.imageshack.us/img193/8537/ballisticgraph2.png [Broken]

    [tex]\frac{x}{e}-d^x + 1[/tex]

    e is the ratio:

    [tex]e = \frac{\sin(\alpha)}{\sin(45^{\circ})}[/tex]

    where α is the launch angle.

    d scales the trajectory.

    If you want the trajectory to be less sensitive to the value of d then use this:

    [tex]\frac{x}{e}-d^{\frac{x}{10}} + 1[/tex]

    The other function is more complex but I think it looks better for it:

    [tex]\frac{x}{e}-\sqrt{\frac{x}{2}^x}+ 1[/tex]

    http://img205.imageshack.us/img205/5281/ballisticgraph3.png [Broken]

    I think it looks like a missile trajectory, no?

    You need to solve

    [tex]\frac{x}{e}-d^{\frac{x}{10}} + 1 = 0[/tex]

    or

    [tex]\frac{x}{e}-\sqrt{\frac{x}{2}^x} + 1 = 0[/tex]

    to find out where the projectile lands in either ballistic graph. Then you simply interpolate in the graph between 0 and where the projectile lands according to the distance to target you've have elapsed so far between the player and target positions.

    However, there still remains the problem of varying the projectile's velocity.

    Maybe a calculus guru can pitch in.
     
    Last edited by a moderator: May 4, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook