feat(cut5b-1): equal-start jackals, ai scavenging, naturalized aim, ots camera & interpolation
This commit is contained in:
parent
cdce8cd843
commit
1eb37e328a
12 changed files with 1548 additions and 225 deletions
|
|
@ -319,7 +319,7 @@ public partial class ArenaRenderer : Node3D
|
|||
_assetCache?.Dispose();
|
||||
}
|
||||
|
||||
public void Sync(ArenaSession session, float elapsedSeconds, float dt = 1f / 60f)
|
||||
public void Sync(ArenaSession session, float elapsedSeconds, float dt = 1f / 60f, float alpha = 1f)
|
||||
{
|
||||
var state = session.State;
|
||||
if (!ReferenceEquals(_builtForState, state))
|
||||
|
|
@ -335,8 +335,8 @@ public partial class ArenaRenderer : Node3D
|
|||
|
||||
_partPool.BeginFrame(hasCam ? cam : null);
|
||||
UpdateSafeCircleRing(state.Terrain, state.Spectators.SafeRadius);
|
||||
SyncContenders(session, dt, hasCam, camPos);
|
||||
SyncSpectators(session, elapsedSeconds, dt, hasCam, camPos);
|
||||
SyncContenders(session, dt, alpha, hasCam, camPos);
|
||||
SyncSpectators(session, elapsedSeconds, dt, alpha, hasCam, camPos);
|
||||
SyncGroundDrops(state, elapsedSeconds, hasCam, camPos);
|
||||
_debris.Step(dt, state.Terrain);
|
||||
_debris.SubmitToPool(_partPool);
|
||||
|
|
@ -496,9 +496,8 @@ public partial class ArenaRenderer : Node3D
|
|||
_safeRingImm.SurfaceEnd();
|
||||
}
|
||||
|
||||
private void SyncContenders(ArenaSession session, float dt, bool hasCam, Vector3 camPos)
|
||||
private void SyncContenders(ArenaSession session, float dt, float alpha, bool hasCam, Vector3 camPos)
|
||||
{
|
||||
var view = session.World.View;
|
||||
var contenders = session.State.Contenders;
|
||||
|
||||
for (int i = 0; i < contenders.Count; i++)
|
||||
|
|
@ -531,24 +530,11 @@ public partial class ArenaRenderer : Node3D
|
|||
|
||||
vis.Visual.Root.Visible = true;
|
||||
|
||||
Vector3 pos;
|
||||
Vector3 vel;
|
||||
var body = session.GetContenderBody(c.Id);
|
||||
if (body is { } h)
|
||||
{
|
||||
int lane = h.Lane;
|
||||
pos = new Vector3(view.PositionX[lane], view.PositionY[lane], view.PositionZ[lane]);
|
||||
var q = new Quaternion(view.RotationX[lane], view.RotationY[lane], view.RotationZ[lane], view.RotationW[lane]);
|
||||
vel = new Vector3(view.VelocityX[lane], view.VelocityY[lane], view.VelocityZ[lane]);
|
||||
vis.Visual.Root.Transform = new Transform3D(new Basis(q), pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = new Vector3(c.X, c.Y, c.Z);
|
||||
vel = Vector3.Zero;
|
||||
vis.Visual.Root.Position = pos;
|
||||
vis.Visual.Root.Rotation = new Vector3(0f, c.Yaw, 0f);
|
||||
}
|
||||
var (interpPos, interpRot, interpVel) = session.GetInterpolatedContenderPose(c.Id, alpha);
|
||||
Vector3 pos = new Vector3(interpPos.X, interpPos.Y, interpPos.Z);
|
||||
Vector3 vel = new Vector3(interpVel.X, interpVel.Y, interpVel.Z);
|
||||
var q = new Quaternion(interpRot.X, interpRot.Y, interpRot.Z, interpRot.W);
|
||||
vis.Visual.Root.Transform = new Transform3D(new Basis(q), pos);
|
||||
|
||||
float distSq = hasCam ? pos.DistanceSquaredTo(camPos) : 0f;
|
||||
bool castShadows = !hasCam || c.IsPlayer || distSq <= 75f * 75f;
|
||||
|
|
@ -582,9 +568,8 @@ public partial class ArenaRenderer : Node3D
|
|||
}
|
||||
}
|
||||
|
||||
private void SyncSpectators(ArenaSession session, float elapsedSeconds, float dt, bool hasCam, Vector3 camPos)
|
||||
private void SyncSpectators(ArenaSession session, float elapsedSeconds, float dt, float alpha, bool hasCam, Vector3 camPos)
|
||||
{
|
||||
var view = session.World.View;
|
||||
var specs = session.State.Spectators.Spectators;
|
||||
|
||||
for (int i = 0; i < specs.Count; i++)
|
||||
|
|
@ -625,24 +610,11 @@ public partial class ArenaRenderer : Node3D
|
|||
}
|
||||
|
||||
vis.Visual.Root.Visible = true;
|
||||
var body = session.GetSpectatorBody(s.Id);
|
||||
Vector3 specPos;
|
||||
Vector3 vel;
|
||||
if (body is { } h)
|
||||
{
|
||||
int lane = h.Lane;
|
||||
specPos = new Vector3(view.PositionX[lane], view.PositionY[lane], view.PositionZ[lane]);
|
||||
var q = new Quaternion(view.RotationX[lane], view.RotationY[lane], view.RotationZ[lane], view.RotationW[lane]);
|
||||
vel = new Vector3(view.VelocityX[lane], view.VelocityY[lane], view.VelocityZ[lane]);
|
||||
vis.Visual.Root.Transform = new Transform3D(new Basis(q), specPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
specPos = new Vector3(s.X, s.Y, s.Z);
|
||||
vel = Vector3.Zero;
|
||||
vis.Visual.Root.Position = specPos;
|
||||
vis.Visual.Root.Rotation = new Vector3(0f, s.Yaw, 0f);
|
||||
}
|
||||
var (interpPos, interpRot, interpVel) = session.GetInterpolatedSpectatorPose(s.Id, alpha);
|
||||
Vector3 specPos = new Vector3(interpPos.X, interpPos.Y, interpPos.Z);
|
||||
Vector3 vel = new Vector3(interpVel.X, interpVel.Y, interpVel.Z);
|
||||
var q = new Quaternion(interpRot.X, interpRot.Y, interpRot.Z, interpRot.W);
|
||||
vis.Visual.Root.Transform = new Transform3D(new Basis(q), specPos);
|
||||
|
||||
vis.Visual.SyncDamageAndHeat(s.Grid, _debris, vel);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue