Implement verified Grappler body camera and helpers in VR08
This commit is contained in:
1 parent
ffea678e90
commit
43806fe862
39 files changed
+2429
-40
No files matched your search
@@ -27,6 +27,7 @@ public enum BodyResponseProfile { Jimmy, Baseball, Rocketship }
|
||||
public sealed class OriginalBodyPhysics
|
||||
{
|
||||
private readonly OriginalStaticCollision collision;
|
||||
public StaticCollisionContext? LastStaticContext {get;private set;}
|
||||
|
||||
public OriginalBodyPhysics(OriginalStaticCollision collision, bool allowSpecialMaterials = false)
|
||||
{
|
||||
@@ -38,6 +39,14 @@ public sealed class OriginalBodyPhysics
|
||||
|
||||
public int? MaterialFor(SupportHit hit) => collision.MaterialFor(hit);
|
||||
|
||||
/// <summary>Attached47B4B0 inherits the sphere context from physics. Support
|
||||
/// and ray queries neither clear last polygon nor reset nearest distances.</summary>
|
||||
public StaticCollisionMove MoveAttached(Vector3 root,Vector3 desired,float radius)
|
||||
{
|
||||
if(LastStaticContext==null)throw new InvalidOperationException("Attached movement requires the preceding body phase");
|
||||
return collision.Move(root,desired-root,radius,LastStaticContext);
|
||||
}
|
||||
|
||||
public OrdinaryBodyStep Step(OrdinaryBodyState body, float seconds,
|
||||
float radius = OriginalBodySupport.JimmyRadius, float factor = OriginalBodySupport.JimmyFactor,
|
||||
float friction = .8f, float suppressionScale = .5f, bool geometryEnabled = true,
|
||||
@@ -68,6 +77,7 @@ public sealed class OriginalBodyPhysics
|
||||
var delta = RecoveredMotion.Integrate(ref velocity, ref impulse, body.Acceleration,
|
||||
RecoveredMotion.Gravity, seconds);
|
||||
var context = new StaticCollisionContext(radius);
|
||||
LastStaticContext=context;
|
||||
var horizontalFirst = delta.Y <= 0;
|
||||
var move = collision.Move(previous, horizontalFirst ? delta with { Y = 0 } : delta,
|
||||
radius, context, geometryEnabled: geometryEnabled);
|
||||
|
||||
Reference in new issue
Block a user