Restore Goddard leveling and Scooter positional pitch processing
This commit is contained in:
1 parent
74be19eb15
commit
fccc0b9d1b
24 files changed
+967
-8
No files matched your search
@@ -96,10 +96,15 @@ public sealed class ActorPatrol
|
||||
throw new InvalidOperationException("Goddard body solver produced nonfinite state");
|
||||
actor.Position = body.Position;
|
||||
Velocity = body.Velocity;
|
||||
var yawError = (desiredYaw - actor.Rotation.Y) % 360;
|
||||
if (yawError > 180) yawError -= 360;
|
||||
if (yawError < -180) yawError += 360;
|
||||
actor.Rotation = actor.Rotation with { Y = actor.Rotation.Y + yawError * yawFactor * dt };
|
||||
if(FollowPlayer&&actor.Kind=="3DOG")
|
||||
actor.Rotation=GoddardFacing(actor.Rotation,desiredYaw,dt);
|
||||
else
|
||||
{
|
||||
var yawError = (desiredYaw - actor.Rotation.Y) % 360;
|
||||
if (yawError > 180) yawError -= 360;
|
||||
if (yawError < -180) yawError += 360;
|
||||
actor.Rotation = actor.Rotation with { Y = actor.Rotation.Y + yawError * yawFactor * dt };
|
||||
}
|
||||
|
||||
switch (actor.AIstate)
|
||||
{
|
||||
@@ -120,6 +125,16 @@ public sealed class ActorPatrol
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>4096E0 with41C8DB Goddard factors and the ordinary supported
|
||||
/// follow target (pitch/roll0). Dismount copies tilt; this later AI phase
|
||||
/// gradually levels it. Full airborne AI target selection remains separate.</summary>
|
||||
public static Vector3 GoddardFacing(Vector3 rotation,float yaw,float dt)
|
||||
{
|
||||
static float Arc(float delta)=>delta>180?delta-360:delta< -180?delta+360:delta;
|
||||
var delta=new Vector3(Arc(-rotation.X)*.3f*dt,Arc(yaw-rotation.Y)*3.2f*dt,Arc(-rotation.Z)*.3f*dt);
|
||||
return RocketOrientation.Add(rotation,delta);
|
||||
}
|
||||
|
||||
private void StepFollow()
|
||||
{
|
||||
var target=findActor("JIM1");if(target==null||!target.Active)return;
|
||||
|
||||
Reference in new issue
Block a user