Curved flying path from fix point to fix point

I need an enemy projectile to spawn at the enemies position moving to the players position but doing a curve from point to point.

Before the projectile starts I save the current x and y of the player within the actor so the flying destination is known.
Also no interpolate, as I want the path to be interruptible by objects in the way.

So its probably some easy math thing for @socks or @Hopscotch
but hey I am not them. So please help me out here.

Comments

  • jay2dxjay2dx Member Posts: 611

    I'm guessing you would have to track the player position at the point of spawning the enemy projectile and send the actor towards that position X Y calculating the distance from the spawned actor to the player so you can have it move up on the y axis until it reaches half way then have it move down towards the actual recorded y axis the second half! Hope that helps

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2016

    Is that a fish ? :)

    Does this take place on a horizontal plane, I mean are both the player and NME on the same flat surface as in your drawing ? Or is one of them sometimes higher or lower than the other ? ( I'm trying to work out why you'd need to save the player's y position).

  • BigDaveBigDave Member Posts: 2,239
    edited November 2016

    @jay2dx yep that works

    just looking if there is a more elegant version.
    also trying to learn some math here because this version now feels hacky.

    @Socks
    yes its a fish :)
    They can have different Y.

  • BigDaveBigDave Member Posts: 2,239

    also the solution above does not work well if the enemy is above the hero it does work very well if he is below or on the same level.

  • BigDaveBigDave Member Posts: 2,239
    edited November 2016

    see the last murky frog at the top not being able to pull off a proper throw with his fish.

    EDIT: I figured I stopped the movement to early because of fish contact with ground.
    Now it only triggers after 0.3 have passed. So he can now also shoot the fish.
    Also I did the initial acceleration upwards stronger and the acceleration towards a bit weaker. So it kind of works now.

  • BigDaveBigDave Member Posts: 2,239
    edited November 2016


    Hack solution but best I can do myself, it works
    but you see the top left fish slightly falling too much to the right
    (even tough the player hasn't moved yet)

Sign In or Register to comment.