Uncap inward normal velocity deflection from spring ceiling and isolate 5s occlusion test
This commit is contained in:
parent
62089dcff3
commit
47175cf12a
2 changed files with 18 additions and 14 deletions
|
|
@ -671,25 +671,15 @@ namespace RustToDust.Ymir
|
|||
supportForce *= maxSpringY / supportForce.Y;
|
||||
}
|
||||
|
||||
// Steep-slope velocity projection / deflection: damp inward velocity when contacting terrain
|
||||
// Steep-slope velocity projection / deflection: when contacting terrain and moving into the surface,
|
||||
// damp inward normal velocity cleanly (capped at cancelling vn to 0 so it never adds upward launch velocity).
|
||||
if (maxPen > 0f)
|
||||
{
|
||||
float vn = Vector3.Dot(vel, terrainNormal);
|
||||
if (vn < 0f)
|
||||
{
|
||||
float deflectMag = MathF.Min(-vn * mass * 48f, -vn * mass / FixedDt);
|
||||
Vector3 deflectForce = terrainNormal * deflectMag;
|
||||
float maxAllowableY = MathF.Max(0f, maxSpringY - supportForce.Y);
|
||||
if (deflectForce.Y > maxAllowableY)
|
||||
{
|
||||
deflectForce.Y = maxAllowableY;
|
||||
}
|
||||
supportForce += deflectForce;
|
||||
}
|
||||
|
||||
if (maxPen > 0.28f && terrainNormal.Y < 0.88f)
|
||||
{
|
||||
supportForce += new Vector3(terrainNormal.X, 0f, terrainNormal.Z) * (mass * 55f * MathF.Min(maxPen, 1.5f));
|
||||
float deflectMag = MathF.Min(-vn * mass * 42f, -vn * mass / FixedDt);
|
||||
supportForce += terrainNormal * deflectMag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,6 +227,20 @@ namespace RustToDust.Tests
|
|||
var provokedSpec = tourists[0];
|
||||
var clearedSpec = tourists[1];
|
||||
|
||||
// Keep AI contenders safely inside the safe circle and other spectators far away so they don't kill player or steal clearance
|
||||
for (int i = 1; i < session.State.Contenders.Count; i++)
|
||||
{
|
||||
session.SetContenderPose(session.State.Contenders[i].Id, (i - 6) * 12f, 0f);
|
||||
}
|
||||
for (int i = 0; i < session.State.Spectators.Spectators.Count; i++)
|
||||
{
|
||||
var other = session.State.Spectators.Spectators[i];
|
||||
if (other.Id != provokedSpec.Id && other.Id != clearedSpec.Id)
|
||||
{
|
||||
session.SetSpectatorPose(other.Id, -mesa.X, -mesa.Z);
|
||||
}
|
||||
}
|
||||
|
||||
// Place player on the side of the mesa further from center (strictly outside SafeRadius)
|
||||
float xNeg = mesa.X - mesa.RadiusX - 18f;
|
||||
float xPos = mesa.X + mesa.RadiusX + 18f;
|
||||
|
|
|
|||
Loading…
Reference in a new issue