Use ball first-hit rays and retry native prop-occluded split selections through normal merge

This commit is contained in:
NINI
2026-10-07 00:35:13 +09:00
parent 196f0ebb07
commit cd8d574ff8
2 changed files with 32 additions and 9 deletions
+11 -4
View File
@@ -41,12 +41,19 @@ function BallClear($Board,[string]$Id) {
$camera=$Board.camera
$rotation=[Numerics.Quaternion]::new($camera.rotation.x,$camera.rotation.y,$camera.rotation.z,$camera.rotation.w)
$origin=[Numerics.Vector3]::new($camera.target.x,($camera.target.y+.65),$camera.target.z)+[Numerics.Vector3]::Transform([Numerics.Vector3]::new(0,0,-$camera.distance),$rotation)
$target=@($Board.balls|Where-Object id -eq $Id)[0].position
$direction=[Numerics.Vector3]::new($target.x,$target.y,$target.z)-$origin
$targetHit=$direction.Length()-.5
$direction=[Numerics.Vector3]::Normalize($direction)
foreach($ball in $Board.balls){
if($ball.id-eq$Id){continue}
$other=BallPoint $Board $ball.id
$local=[Numerics.Vector3]::Transform([Numerics.Vector3]::new($ball.position.x,$ball.position.y,$ball.position.z)-$origin,[Numerics.Quaternion]::Inverse($rotation))
$radius=540*.55/([Math]::Tan(31*[Math]::PI/180)*$local.Z)
if([Math]::Pow($point[0]-$other[0],2)+[Math]::Pow($point[1]-$other[1],2)-lt[Math]::Pow($radius+8,2)){return $false}
$delta=[Numerics.Vector3]::new($ball.position.x,$ball.position.y,$ball.position.z)-$origin
$along=[Numerics.Vector3]::Dot($direction,$delta)
$perpendicularSquared=$delta.LengthSquared()-$along*$along
if($perpendicularSquared-le.25){
$near=$along-[Math]::Sqrt([Math]::Max(0,.25-$perpendicularSquared))
if($near-ge0-and$near-lt$targetHit){return $false}
}
}
return $true
}