How to set an arrow trajectory

Let say that my archer shoots an arrow and I would like the arrow to always point to the direction it is traveling to. How can I do this?

Comments

  • 3itg3itg Member, PRO Posts: 382
    trigonometry?
  • ArmellineArmelline Member, PRO Posts: 5,371
    What rules are you using to control the motion of the arrow?
  • 3itg3itg Member, PRO Posts: 382
    edited February 2014
    Sorry, could resist but didnt...
    vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y )
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Ok!
    When it is spawned by the Bow actor
    it has an Accelerate: Direction=270, Acceleration= 600, relative to scene
    Then it has a Change Velocity: Direction=0 Speed= game.Power +game.BasePower
    Relative to actor

    It goes where it is supposed to go but it doesn't rotate so sometimes the arrow hits the enemy sideways.

    @3itg: where should I add the vector to angle rule?
  • 3itg3itg Member, PRO Posts: 382
    edited February 2014
    Constrain the Arrows rotation to the vectorToAngle
    Accelerate the arrow at 0 as well... 270 sounds more like the direction you want to fire in.
    Edit: I made an example of what I think you want, plus a little more.
    The gravity is set pretty high in the scene, as well as arrows physics should be paid attention to. I exaggerated everything in the example.
    https://dl.dropboxusercontent.com/u/93591418/Archer Example.zip

    I made a rule to allow make the "Force" apply for .3 seconds, to get that "Arrow" feel, you cant keep pushing the arrow after its been fired. After that I just let the physics settings take over.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Omg my friend, thanks for all the trouble you went to make this. I really appreciate it!
    I'll get right to it!
Sign In or Register to comment.