(Disclaimer: a world built from an array is bad for you and you should use trees or spatial hashes or something to make it faster.)
I'm using an array of objects with simple 3d geometry. Some of them are solid, some are holes, some are "special", meaning event triggers or traps or whathaveyou.
There are too object pointers for handling collisions: "atop" and "bumped". When the player collides with a solid object, atop points to that object if the player is within 20cm of the top, otherwise bumped points to the object.
When a player touches a hole, atop and bumped become null, with the exception that if the player's feet are outside of the hole, atop can point to bumped (otherwise some weird crap can happen).
So, in theory, the array is ordered so that holes come after the objects they're cut/dug/etc into. So the first object is the ground, then a large rock formation, then a hole that makes the rock formation hollow, then a hole to serve as a tunnel connecting the outside and inside of the cave. Everything inside the cave comes after those holes. There is one more hole to cut a chamber in a pyramidal structure at the bottom of the cave, which is followed only by "special" items. I've checked the numbers and the type flags, and if any of them are wrong, it's slipped past me several times.
So, the problem? Well, there are two:
1: you can't touch anything inside the cave, other than the ramp leading inside. the top of that ramp sticks out a bit, whereas the others are fully contained by either the cave or the ground. This appears to apply to event triggers, too, but no promises. I checked, and the loop is not aborting early.
2: At a certain point, the cave just effing vanishes so far as hit detection is concerned. This point is far underground. Most of the time, this results in bumped pointing to the ground--so it basically acts as though there are no other objects, period. This looked like it might be a collision issue, but I checked in several different ways, and the hit detection works as it should. I even put in a check to see if, when bumped is the ground, the player collides with the inside of the cave--and it does.
So, basically, things are just vanishing for no reason. They're in the correct places; hit detection works; it's just ignoring them, somewhy.
I have no idea what's going on.
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
George... Don't do that.