How do I create an arc shape aim preview (img provided-help with math)?

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello! Could someone help me with some math? I need to get an elipse shape that works for any angle. Right now I can only get a perfect circle.

    I'm trying to achieve an aim preview, like demonstrated above. Thanks for any help.

    Tagged:

  • Aiming arcs are generally described from the origin to destination, one step at a time, rather than from a center point.

    The functions for the x and y components are x = horizontal velocity * time, and y = vertical velocity * gravity * time.

    The initial velocities can be found per angle by using sin and cos on the angle multiplied by a power value.

    Edit: sorry looks like your going for an isometric arc based on your screenshot. In that case, your x and y are both constant and you'll need to add a z component, which is affected by gravity. In effect, the z value is added to the y value to display "height". When z is equal to or less than 0 is when your projectile hits the "ground".

  • Aiming arcs are generally described from the origin to destination, one step at a time, rather than from a center point.

    The functions for the x and y components are x = horizontal velocity * time, and y = vertical velocity * gravity * time.

    The initial velocities can be found per angle by using sin and cos on the angle multiplied by a power value.

    Edit: sorry looks like your going for an isometric arc based on your screenshot. In that case, your x and y are both constant and you'll need to add a z component, which is affected by gravity. In effect, the z value is added to the y value to display "height". When z is equal to or less than 0 is when your projectile hits the "ground".

    Could you write an example of the equation? I'm terrible at math =/

    btw, I'm trying to achieve an aim indicator, those sprites would be static but updating its position accordingly to the target(mouse x and y for instance)

  • It's more physics than math. You still need to describe in more detail the desired behavior. If the input value is the destination coordinates (instead of origin angle and velocity), would you want the resulting arc of travel have a static angle, velocity, or vertical height?

  • It's more physics than math. You still need to describe in more detail the desired behavior. If the input value is the destination coordinates (instead of origin angle and velocity), would you want the resulting arc of travel have a static angle, velocity, or vertical height?

    I'm not shooting anything so I don't need movement, I just need to draw a curved line(see the illustration in the first post). I'm using this arc to indicate to the player that the character can jump to the selected tile(tru mouse aiming). It's just a more fancy preview with some depth to show to the player what he's about to do, which is jump to this other tile.

  • You asked for an example equation. The equation is different depending on how you want to draw the arc at different distances.

  • You asked for an example equation. The equation is different depending on how you want to draw the arc at different distances.

    alright, I think fixed angle should work well

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This should work I think. It lerps between the start and end in a straight line. Then also moves in a parabola.

    dropbox.com/s/ilxsoyy7mmm04dc/jump_path.c3p

  • This should work I think. It lerps between the start and end in a straight line. Then also moves in a parabola.

    https://www.dropbox.com/s/ilxsoyy7mmm04dc/jump_path.c3p?dl=1

    Works perfectly, exactly what I needed. Thank you very much, Rojo and oosyrag for your time.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)