using System.Numerics; namespace GamePort.Game; public readonly record struct ScooterCameraResult(Vector3 Eye,Vector3 Target,Vector3 DesiredEye,Vector3 Look,float Gain); /// 4130A0 default mode1. Clipping follows smoothing and uses a sphere, /// then look minus NEW eye determines source signed14-bit aim. public static class ScooterCamera { public static ScooterCameraResult Follow(Vector3 root,Vector3 rotation,Vector3 oldEye,float dt,Func? clip=null,bool impact=false) { var desired=root+RocketOrientation.Rotate(new(-30,0,-200),rotation)+Vector3.UnitY*50; var delta=desired-oldEye;var distance=OriginalBodySupport.QuickMagnitude(delta); float gain=distance>400?2.8f:distance>200?1.7f:1; var eye=oldEye+delta*dt*gain; if(impact) { //413157..4131C0: approach root X/Z at .3; leave eye Y unchanged. desired=new(root.X,oldEye.Y,root.Z);gain=.3f;eye=oldEye+(desired-oldEye)*dt*gain; } if(clip!=null)eye=clip(root,eye); var look=impact?root:root+RocketOrientation.Rotate(new(0,50,100),rotation); var(p,y)=OriginalHeading.Angles(look-eye); var direction=RocketOrientation.Rotate(Vector3.UnitZ,new(p*.02197265625f,y*.02197265625f,0)); return new(eye,eye+direction*200,desired,look,gain); } }