Curved movement help?

*please see attached pic

I have some spawn points (green) set up where actors spawn from and they move towards the red X. Actors spawn from a random spawn point. I can only make them move in a straight line though, so how do I make them move in random curved directions and yet still move towards the red X?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    You could send the spawned actors towards the red X by first using a simple Move behaviour to initially getting them moving, their direction should be relative to 'actor' and the actual direction they are moving towards can be, initially, arbitrary.

    Then slowly turn them towards the target using rotate to position.

    Vary their velocity and the speed of their turn to randomise the paths.

    Let me make you a quick demo . . . .

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    Here is the basic set-up, I am only spawning from a single location but it should illustrate the basic idea . . .

    Link: https://www.mediafire.com/?caqz2kz2zmz0qbs

    . . . . .

  • TonyuTonyu Member Posts: 21

    @Socks said:
    Here is the basic set-up, I am only spawning from a single location but it should illustrate the basic idea . . .

    Link: https://www.mediafire.com/?caqz2kz2zmz0qbs

    . . . . .

    Thank you so much! I was told before to use rotate but I didn't realize until you showed me that I was supposed to use "rotate to position". Just one question though, is there a way to prevent the spawned actors' image from rotating? Like if I want them their sprite to stay upright but still move in a curved path towards the target?

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Tonyu said:
    . . . is there a way to prevent the spawned actors' image from rotating?

    No ! This method relies on them rotating unfortunately, to keep the actors upright you'd probably have to come up with another method, but it should be too difficult.

  • TonyuTonyu Member Posts: 21

    @Socks said:
    No ! This method relies on them rotating unfortunately, to keep the actors upright you'd probably have to come up with another method, but it should be too difficult.

    I did find a workaround just now although I don't think it's very efficient. I tried a universal attribute of X and Y, constrained it to the projectiles' position, then created a new actor with the character image and constrained it to game.x and y. They move along the curved path in your sample, although I think this method would eat up a lot of processing power. What do you think?

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Tonyu said:
    I did find a workaround just now although I don't think it's very efficient. I tried a universal attribute of X and Y, constrained it to the projectiles' position, then created a new actor with the character image and constrained it to game.x and y.

    That would work for one actor, but if you have more than one projectile on screen at once you would need to create two attributes for each, like you say it's not very efficient.

    @Tonyu said:
    They move along the curved path in your sample, although I think this method would eat up a lot of processing power. What do you think?

    I don't know what this means, too vague for me I'm afraid.

Sign In or Register to comment.