Creates a new CollisionDetection instance.
Initializes bounding boxes for all anatomical regions and organizes vital points by region for efficient lookup.
PrivatecalculatePrivateCalculates effective attack reach for a technique.
Korean: 공격 범위 계산
Applies stance modifiers to base technique reach.
Type of technique
Current trigram stance
Attack reach with all modifiers applied
PrivatecalculatePrivateCalculates Euclidean distance between two 3D points.
First position
Second position
Distance in meters
PrivatecalculatePrivateCalculates hit accuracy based on distance to vital point center.
Korean: 타격 정확도 계산
Accuracy decreases linearly with distance from vital point center. Perfect accuracy (1.0) at center, decreasing to 0 at 5cm radius.
Point where attack landed
Target vital point
Accuracy value from 0 to 1
Checks if an attack hits the defender.
Korean: 공격 타격 확인
Performs two-phase collision detection:
3D position of the attacker
3D position of the defender
Technique being used with type information
Attacker's current trigram stance
Anatomical region being targeted
Collision result with hit status, vital point, distance, and accuracy
PrivatecreatePrivateCreates Three.js geometry for a bounding box.
Helper method for geometry cache initialization.
Bounding box specification
Three.js geometry
Gets all bounding boxes.
Map of all bounding boxes by region
Gets the bounding box for an anatomical region.
Anatomical region
Bounding box or undefined if not found
Gets vital points for a specific region.
Anatomical region
Array of vital points in that region
PrivateidentifyPrivateIdentifies the specific vital point hit within a region.
Korean: 급소 식별
Finds the closest vital point to the hit location within the targeted region.
Anatomical region hit
3D point where attack intersected
Closest vital point or null if none found
PrivateinitializePrivateinitializePrivatenormalizePrivateNormalizes a 3D vector to unit length.
Vector to normalize
Normalized vector
PrivateorganizePrivateOrganizes vital points by anatomical region for efficient lookup.
NOTE: This categorization currently uses y-coordinate thresholds that assume positions are in meters. However, VITAL_POINTS_DATA uses pixel coordinates (e.g., y: 50), which will cause incorrect categorization. Most vital points will end up in the "legs" region since pixel y-coordinates are typically less than 0.8.
TODO: After implementing 2D→3D coordinate mapping, update this method to use the converted 3D positions, or use the anatomical region data that may already exist in the vital points data structure.
Categorizes the 70 vital points into their respective regions:
PrivateparsePrivateParses technique type from string.
OptionaltechniqueTypeStr: stringTechnique type as string
Parsed technique type
PrivateraycastPrivatePerforms raycasting against a bounding box.
Korean: 경계 상자 광선 투사
Uses cached geometries from object pool to avoid repeated allocations during combat. Creates a Three.js mesh for the bounding box and performs raycasting to detect intersection points.
Uses object pooling for Vector3 allocations to reduce GC pressure.
Raycast query parameters
Bounding box to test
Position of the defender
Intersection point or null if no hit
PrivatesubtractPrivateSubtracts one 3D vector from another.
First vector
Second vector
Resulting vector
Collision Detection Engine for combat physics.
Korean: 충돌 감지 엔진
Provides efficient collision detection for combat using bounding boxes and raycasting. Optimized for 60fps performance with multiple simultaneous collision checks.
Korean
충돌감지엔진