Overhauling the Trap Placement


Author: Tyler Clardy
Date Posted: 6/17/2024

This week I am focusing on overhauling our 'Place Trap' ability. I've started by creating a custom reticle for placement - though it is somewhat unreliable in its current state.

The custom reticle can be seen here:


The base setup for it is very simple, just featuring a collider box and a small cone that can show red or green. In the center of the collider, during actual placement, a temporary visualization of the chosen trap model is shown as well.

The logic is significantly more complex. I spent several hours iterating over pre-existing collision checking logic I created several weeks ago, and integrating it into this reticle to track when to turn red or green. This is done every tick, by first checking if the location is on the ground, and if it is then checking for anything it could be colliding with.

Per Tick Logic:


Collision Checking Logic:


Currently, it functions roughly 75% of the time. Occasionally, though, it will be red but allow placement, or be green and not allow placement. I intend to spend the rest of the week fine-tuning this and bug-fixing it. I would like the collision checking in the traps logic, the collision checking in the Spawn Trap ability, and the collision checking in this custom reticle to all be perfectly in-sync with each other.

The new visualization and reticle system can be seen, in its current state, below:

Leave a comment

Log in with itch.io to leave a comment.