How do I Arrow flight

0 favourites
  • 4 posts
From the Asset Store
Jump to avoid obstacles and and let's see how long you can survive!
  • HI Guys,

    I'm looking for action -- then Fire a "Arrow" with physics and a Denser Physic at the Arrow Head ---

    I need to simulate the flight of the arrow.

    When arrow's reaching max height

    1. The edge of the arrow should fall first and only after the body of the arrow.

    My arrow instead flight like peace of crap (fully solid object with center of the mass in the center). Dropping on body of the arrow first

    I have broken my head already.

    Do you have any Ideas?

  • If you're using the physics behavior, you can apply a torque to the arrow to make it straighten out towards the direction it's moving.

    This torque should be greater the faster the arrow is moving. So, if it's sitting on the ground, no torque. If it's flying fast, lots of torque.

    You can use the "Apply torque towards angle" action to get this effect.

    It would look something like the following:

    Apply torque towards angle:

    • Torque: 0.001 * arrow_speed
    • Angle: arrow_movement_angle

    (The "0.001" just scales the amount of torque used to correct the arrow angle. You can experiment with it.)

    Of course there are no "arrow_speed" or "arrow_movement_angle" values by those names, so you'll need to calculate that information, but fortunately that's not too hard.

    We can get the speed by finding the length of the Physics behavior's velocity vector. We get the angle by finding the angle of the velocity vector.

    Apply torque towards angle:

    • Torque: 0.001 * distance( 0 , 0 , arrow.Physics.VelocityX , arrow.Physics.VelocityY )
    • Angle: angle( 0 , 0 , arrow.Physics.VelocityX , arrow.Physics.VelocityY )

    This should make arrows fly head first, but will still allow them to topple end-over-end if they bounce off of something and lose most of their speed.

    This is not a perfect simulation of arrow flight, as it doesn't account for linear off-axis forces resulting from the separate center of gravity, and center of pressure, but for it's simplicity it is pretty close.

    I actually just uploaded an update of a game I made that uses this exact method for handling arrow flight.


    (note: Firefox runs it a little slow, but every other browser, and the desktop version run fine.)

    Hope that helps out <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thank you for your help Fisholith

  • I've got the solution based on your comment!!! Thank you very much again!

    Here is the example:

    Every 0.1 sec. - Arrow Set Angle: angle( 0 , 0 , arrow.Physics.VelocityX , arrow.Physics.VelocityY )

    Easy and cosy

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