0 Favourites

Physics - Set arrows angle to follow path

This forum is currently in read-only mode.
  • Hi All

    Ive checked examples and posts and cant really find a way to solve my problem.

    I want to fire and arrow like angy birds style. (ive solved that)

    BUT i want the arrow tip to follow the flight path.

    I use add force to launch the arrow (i need physics in my test game) but i dont know how to set the angle. Do you use torque in some way?

  • Here is a cap to show what im trying to do. Hope someone has an idea or workaround on how to get the arrow to rotate with the trajectory.

    Cap test file

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • A few things to mention:

    You can't directly change the angle of the object (just as you can't directly change the position of the object) without breaking the physics behavior.

    The sprite was drawn with facing up as initial state. But initially all sprites are at 0�, which is facing right.

    To get the rotation just add a second sprite, set it to always be at the first sprite's position and cache the last position. Then just set the angle of the second sprite to the angle between the last and actual position.

    Here is an example: phys_Angle.cap

  • That is a brilliant workaround. Thank you.

    I just removed the physics behaviour from the second arrow, cause it was multiplying the effect and was too speedy. :)

    Its is to bad though that you cant change the angle without stoping the physics behaviour. Could have been cooler if you could apply force and angle while it was moving and not stopping.

    Thanks again:)

  • I just removed the physics behaviour from the second arrow, cause it was multiplying the effect and was too speedy. :)

    My bad. It wasn't intended, I just forgot to remove it after duplicating the original sprite :)

    I'm glad that it was of help.

    With physics and angles: Don't forget that there's friction and the like, so objects need to be rotated physically correct on contact by the engine - that's why rotating an object manually would break it.

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