Projectile Direction

What I have right now is a game in progress in which the character throws pies when you click and towards where you click. I am having issues getting the pies to be projected from the character towards where I click when I click. I currently have rules set that say a pie is spawned on the actor every time you click. Once spawned the pie is set to move to the X and Y position of the crosshair (an actor set to follow the cursor). The X and Y position of the crosshair is updated globally every time I click.

Two problems have come up:
1). If a pie is still in motion and I click again, the pie will change direction towards the updated crosshair position.
2). Using a move to rule makes it so the pie stops exactly where I clicked.

So basically, I need to find a way to lock each pie spawned on a target direction rather than having them conform to coordinates every time they are updated, and then have them move in the direction of those coordinates rather than to those coordinates. Any help is very much appreciated. Thanks.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited November 2014

    The spawned "pie" actor just needs one behavior:

    Change Velocity
        Direction: vectorToAngle(game.Mouse.Position.X-self.Position.X, game.Mouse.Position.Y-self.Position.Y)
        Relative to: scene
        Speed: 100
    
Sign In or Register to comment.