Author Topic: Physics.OverlapShere as a way to "check if space is occupied"  (Read 1422 times)


  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Hey all!

Ok, playmaker is awesome.  Been using it all semester for my class work.  I'm not very good with code, never really have been, so Playmaker has been an amazing tool to get going on making games.

That being said, I'm kind of running into a bit of a snag.  I have a game where I'm spawning buildings (that get crushed and stepped on by the player, like they do).  The spawn is stationary and the buildings move away from the spawner when the player "moves" (animation of 'walk' plays but the player is stationary and the building are what actually move).

The problem I have is that if the player isn't holding the move input, the buildings don't move, and the spawners just spawn tons of buildings into each other.  They pile up into one big building blob.  When the player hits this blob, it collateral damage freezes the system to 1FPS.  It also starts a massive chain reaction that destroys more buildings than the player can see. 

I'm trying to use: as a way to check for overlapping colliders... and it works slightly.  It checks the overlapping collider index... but when it reaches the end of the index, it "finishes" and moves on.  Is there a way to keep checking the index until the object moves away from the collider (check index until index == 0 entries) rather than how many objects collided then move on?

Has anyone used overlap or have solved the problem in Unity of "spawning only when space is unoccupied"?  I'm simply trying to check of area is vacant before spawning an object in it.


  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Physics.OverlapShere as a way to "check if space is occupied"
« Reply #1 on: April 14, 2015, 11:37:16 AM »
Hi, wrong place to be posting in but anyway why don't you have a rule in place.

If building is not moving (or key input not down/active), set bool to false, have an action in the spawn FSM that when bool is false, no spawn (stop loop? or send event to another action in fsm? etc). When True spawn until bool change back to false. Setup a rule in the spawn fsm.