BulletSim: fix small bug where everything looked like it was colliding
before the first simulator step.cpu-performance
parent
894554faf6
commit
2c8bf4aaa6
|
@ -103,9 +103,10 @@ public abstract class BSPhysObject : PhysicsActor
|
||||||
CollisionsLastTickStep = -1;
|
CollisionsLastTickStep = -1;
|
||||||
|
|
||||||
SubscribedEventsMs = 0;
|
SubscribedEventsMs = 0;
|
||||||
CollidingStep = 0;
|
// Crazy values that will never be true
|
||||||
CollidingGroundStep = 0;
|
CollidingStep = BSScene.NotASimulationStep;
|
||||||
CollisionAccumulation = 0;
|
CollidingGroundStep = BSScene.NotASimulationStep;
|
||||||
|
CollisionAccumulation = BSScene.NotASimulationStep;
|
||||||
ColliderIsMoving = false;
|
ColliderIsMoving = false;
|
||||||
CollisionScore = 0;
|
CollisionScore = 0;
|
||||||
|
|
||||||
|
@ -349,7 +350,7 @@ public abstract class BSPhysObject : PhysicsActor
|
||||||
if (value)
|
if (value)
|
||||||
CollidingStep = PhysScene.SimulationStep;
|
CollidingStep = PhysScene.SimulationStep;
|
||||||
else
|
else
|
||||||
CollidingStep = 0;
|
CollidingStep = BSScene.NotASimulationStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override bool CollidingGround {
|
public override bool CollidingGround {
|
||||||
|
@ -359,7 +360,7 @@ public abstract class BSPhysObject : PhysicsActor
|
||||||
if (value)
|
if (value)
|
||||||
CollidingGroundStep = PhysScene.SimulationStep;
|
CollidingGroundStep = PhysScene.SimulationStep;
|
||||||
else
|
else
|
||||||
CollidingGroundStep = 0;
|
CollidingGroundStep = BSScene.NotASimulationStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override bool CollidingObj {
|
public override bool CollidingObj {
|
||||||
|
@ -368,7 +369,7 @@ public abstract class BSPhysObject : PhysicsActor
|
||||||
if (value)
|
if (value)
|
||||||
CollidingObjectStep = PhysScene.SimulationStep;
|
CollidingObjectStep = PhysScene.SimulationStep;
|
||||||
else
|
else
|
||||||
CollidingObjectStep = 0;
|
CollidingObjectStep = BSScene.NotASimulationStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
|
|
||||||
internal long m_simulationStep = 0; // The current simulation step.
|
internal long m_simulationStep = 0; // The current simulation step.
|
||||||
public long SimulationStep { get { return m_simulationStep; } }
|
public long SimulationStep { get { return m_simulationStep; } }
|
||||||
|
// A number to use for SimulationStep that is probably not any step value
|
||||||
|
// Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step.
|
||||||
|
public static long NotASimulationStep = -1234;
|
||||||
|
|
||||||
internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate()
|
internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue