Pretty new here.
We’re working on a 2.5D platformer. We have a character running along and an enemy in the background (different depth) that has a light that scans back and forth along the playing pane. If the character steps into the light, this will alert the guards (standard fair).
So I’ve got a game object representing the enemy in the background rotating right and left and i’ve got a simple game object on the players pane with a box collider set to trigger moving right and left. My question is what’s the best way to pair these. The options I’ve considered:
- Child the trigger collider to the enemy and reset it’s z-position every update frame.
- Keep them as separate object and have one hold a reference to the other, so:
a. Have the trigger hold the enemy and update itself according to the enemy’s rotation.
b. Have the enemy keep track of the trigger and actually make the trigger be the thing that is moving.
Of course, other suggestions I may not have thought of are more than welcome!
So really it’s a logical design question. As this is currently the most complicated thing I’ve ever done in Unity (like I said, pretty new), I want to make sure I understand the thinking behind design in the engine correctly.
Thanks!