Trap Placement System

Technical Design
Project Overview
The Trap Placement System is a sophisticated auxiliary system designed to ensure the legitimacy of trap placement by players. Moreover, it automatically try to reassign the nearest valid location if the initially chosen location is deemed invalid.
Role
Technical Level Designer
|
Brief Approach
1. Location Selection
When players place props, they can select the desired location within a designated radius. A ray will be cast from the player's head to the desired location to ensure there are no obstructions in the line of sight. Additionally, the system automatically detects the terrain's slope to ensure that the prop snaps to the ground after placement.
2. Validity Checking
(1) Collision check to prevent overlap: To ensure the legitimacy of trap placement locations, a collision check is performed above the desired location, examining for obstacles or objects that could potentially overlap with the trap.
(2) Maintaining natural and plausible trap locations with tilt limit and height limit verification: [2.1] After identifying desired locations, the system examines the angle between the location's normal (perpendicular direction) and the horizontal plane. This validation ensures that traps occur in areas where the tilt for trap placement is within acceptable limits, thereby enhancing authenticity and plausibility. [2.2] Additionally, the system offsets the desired location in four directions (up, down, left, right), perpendicular to its normal, each at a distance equal to the trap radius. Subsequently, four rays are emitted parallel to the location's normal to above locations. Analyzing the range of hit distances from these rays ensures that the desired location zone remains within the specified height limit, preventing unrealistic placements on locations with significant height variations.
3. Reassignment of the Nearest Valid Location
If the desired location is deemed invalid during the collision check, the system will execute a reassignment algorithm. It will attempt to push the location away from the nearest obstacle to find a nearest valid spot (repeating this process twice to explore potential valid locations near corners). If, after reassignment, the location still violates any validity checks, the trap will not be placed.
Usage Sample
Legit
Legit after reassignment
Legit after reassignment twice
Height limit violation occurs after reassignment.