How to stop actors overlapping?

RedRoboRedRobo Member, PRO Posts: 682

Hi everyone

I have a bunch or actors that are randomly spawning within a square area. Does anyone know of a way to stop them spawning on top of each other? Is there a kind of check that the actor can do after it is spawned and if it is too close to another actor re-spawn itself?

Comments

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956

    Do you have collisions in the actors?

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I think the simplest way would be to check if the actor is colliding with another actor once it is spawned. If it is colliding, destroy it and re-spawn it at a new location.

  • SocksSocks London, UK.Member Posts: 12,822

    @strag said:
    Hi everyone

    I have a bunch or actors that are randomly spawning within a square area. Does anyone know of a way to stop them spawning on top of each other? Is there a kind of check that the actor can do after it is spawned and if it is too close to another actor re-spawn itself?

    Set them to collide with each other, if they spawn in the same place or overlapping they will push each other aside so they are not overlapping - you might also want to switch fixed rotation on to stop them rotating as they order themselves.

  • RedRoboRedRobo Member, PRO Posts: 682

    They sound like great ideas guys...thanks a lot:)

    I will give them a go and let you know how I get on :D

  • RedRoboRedRobo Member, PRO Posts: 682

    @Rabid Parrot said:
    Do you have collisions in the actors?

    Not yet but that's the next thing I'm going to try...

Sign In or Register to comment.