|
Post by Anonymous on Jul 15, 2014 19:39:30 GMT -8
|
|
Laddo D
Magicmaker Developer
Magicmaker Maker
Posts: 215
|
Post by Laddo D on Jul 16, 2014 17:46:09 GMT -8
Thanks for posting this.
Were there any spiders nearby or in the room? Sometimes they push each other into walls, and this might be an instance of that.
|
|
|
Post by Anonymous on Jul 16, 2014 18:08:19 GMT -8
I have no idea. There were a lot of spiders everywhere, so that sounds like a reasonable enough possibility. They did a really good job of pushing it in if that's what happened.
|
|
Laddo D
Magicmaker Developer
Magicmaker Maker
Posts: 215
|
Post by Laddo D on Jul 17, 2014 9:27:51 GMT -8
Once something gets pushed into a wall like that, physics kinda freaks out and doesn't know what to do with it. Just a little push is enough to get it in an invalid state. I'm betting that's what happened.
|
|
|
Post by nmccoy on Aug 31, 2014 20:21:56 GMT -8
Just a thought, but have you considered detecting when an entity is embedded in a wall (possibly as simple as "has the physics engine tried to eject me in more than two directions this frame"), and finding a nearby close point to eject it to? Something like, when an entity is trapped in the map, do a breadth-first search to find a safe place to eject it; try checking a displaced copy of its bounding box by N units in each of several directions (possibly doing a radial sweep), then repeat while incrementing N until you find a non-trapped space to put it in (or until N gets large enough that you consider it a lost cause, in which case destroy or disable the entity since it's not going to be accessible or useful anyway). 2D spaces are relatively easy to scan in this fashion, and most entities will spend a vast majority of their time not stuck inside walls, so the performance overhead of this algorithm should be minimal.
Alternatively, prevent the spiders from pushing each other if the push would embed any of the bounding box's corners in a wall. I'd certainly prefer stacked spiders to wall-trapped spiders.
|
|
Laddo D
Magicmaker Developer
Magicmaker Maker
Posts: 215
|
Post by Laddo D on Sept 1, 2014 12:22:59 GMT -8
This is a really good suggestion, but it'll probably be easier to prevent entering the invalid state then trying to fix it after the fact. I'm gonna see if I can get that to work.
|
|