Hallways and Room Overlap
Author: Najee Jackson
Problem
This week, I worked on fixing room overlap. To do this, I made a MakeHall Function, which would build halls between rooms, but when building levels, room walls would overlap with doors connected to other rooms, blocking the player from progressing through the level. I also ran into the issue that a doorway would not spawn at the end when making halls. Which broke emersion as the player went through the level.
Solution
To fix the first problem, I had to check for overlapping actors in my randomized-level script after I spawned a room. To do this, I made a function that would take each room's door array and loop through it to see if any actors were overlapping the door actor. If so, I got the class name and checked whether it was a wall collision or another door. If it was one of those actors, I removed it from that room's array and destroyed the actor. This worked most of the time, but sometimes, it would not register that something was overlapping with a door, and a wall would spawn on top, or it would destroy the walls next to the door and leave a giant gap. To fix this issue, I made another hitbox called DoorOverlapBox on the door that would only collide with objects that spawned on top of the door actor. Instead of checking the door actor for overlapping actors, I checked that door's DoorOverlapBox. That gave me a more accurate overlapping and eliminated the deletion of side walls and fixed walls spawning on top. To fix the second issue, I added a function that spawned a door at the end of the room if its hall bool was true. The hardest part was figuring out how to get the doors position right no mater the rotation. To do this, I used the room's right vector and multiplied it by 400 so it would move the door from the outside of the hall to the middle. I also used the actor's location and rotation and the room's tile length to figure out the door's position and which way the door should face.




Comments
Post a Comment