Recover Grappler aim gating and implement verified ray constraint components
This commit is contained in:
1 parent
0c913d15aa
commit
ffea678e90
21 files changed
+1604
-16
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using System.Numerics;
|
||||
using GamePort.Assets;
|
||||
|
||||
namespace GamePort.Game;
|
||||
|
||||
/// <summary>Bounded VR08 root/full-Euler ray and first-hit material snapshot.
|
||||
/// Aiming's early return must gate later primary-fire attachment dispatch.</summary>
|
||||
public sealed class GrapplerRay
|
||||
{
|
||||
private readonly OriginalCameraRay geometry;
|
||||
public GrapplerRay(Mesh world,string level)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(world);
|
||||
if(level!="VR08")throw new NotSupportedException("Grappler ray admission currently covers VR08");
|
||||
if(!world.HasCollisionMaterialIds||world.CollisionPolygons.Any(p=>p.MaterialId is not(0 or 2 or 3 or 4)))
|
||||
throw new NotSupportedException("VR08 requires its verified material/definition profile");
|
||||
geometry=OriginalCameraRay.FromRouteScene(world,level);
|
||||
}
|
||||
|
||||
public Vector3 Endpoint(Vector3 root,Vector3 rotation)=>root+RocketOrientation.Rotate(new(0,2400,2400),rotation);
|
||||
public CameraRaySelection? Trace(Vector3 root,Vector3 rotation)=>geometry.TraceSelectedGeometry(root,Endpoint(root,rotation));
|
||||
|
||||
public GrapplerAim Aim(Vector3 root,Vector3 rotation,bool fire,bool enter,float length,float seconds)
|
||||
{
|
||||
var endpoint=Endpoint(root,rotation);
|
||||
var selection=geometry.TraceSelectedGeometry(root,endpoint);
|
||||
var surface=selection is{} s?new GrapplerSurface(true,true,true,s.Polygon.MaterialId!.Value):default;
|
||||
return GrapplerGeometry.Aim(root,endpoint,selection?.Hit.Position,surface,fire,enter,length,seconds);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user