Hello Simon,
On Day 75, the stairwell was added. I noticed that in my MoveEntity
I had added a check to ensure the colliding entities had the same Z coordinate. However, I had to remove this check for the SpeculativeCollide
to work.
Now, my hero collides with walls in the layers above and below the layer he is on because the TestWall
function only checks in X and Y. I am not sure how in the actual Handmade Hero code this is not happening. Ill just compile the code I got from the pre-order and step through that to figure out how its avoiding this.
I had a guess that the way I'm constructing the SimRegion
is wrong. Do you by any chance happen to remember or just know how thick the simulation region was in the z direction? For me it goes thick enough to grab entities from the layers above and below. I think the bug must be there, because it doesn't probably make sense to grab entities from the other layers. I get 5 chunk layers from above and below (total 10 layers). If this is the intended volume, can you tell me why it was made like that?
Also, can you tell me what the SpeculativeCollide
was doing here?
(AbsoluteValue(Mover->P.Z - Ground) > StepHeight) // StepHeight = 0.1f
Does this mean to say: "If the hero has not moved a lot in the z-direction then collide with the stairwell". With the intent that if you are on the floor, then you have not moved in z and should collide. If you enter from the ends, you will be moved due to the lerp in z and will not collide. Basically then this is saying, turn off collision with stairwell when there has been movement in z-direction during the collision loop. So I could possibly jump into the stairwell from the side?