BulletSim: Add physical 'actors' that operate on the physical object.

Add first 'actor' for locked axis.
This commit is contained in:
Robert Adams
2013-03-31 09:12:18 -07:00
parent 9b83e53b28
commit 2c581cae2a
4 changed files with 311 additions and 74 deletions

View File

@@ -78,6 +78,9 @@ public abstract class BSPhysObject : PhysicsActor
Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
TypeName = typeName;
// The collection of things that push me around
PhysicalActors = new BSActorCollection(PhysicsScene);
// Initialize variables kept in base.
GravModifier = 1.0f;
Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
@@ -109,6 +112,10 @@ public abstract class BSPhysObject : PhysicsActor
{
UnRegisterAllPreStepActions();
UnRegisterAllPostStepActions();
PhysicsScene.TaintedObject("BSPhysObject.Destroy", delegate()
{
PhysicalActors.Release();
});
}
public BSScene PhysicsScene { get; protected set; }
@@ -230,6 +237,7 @@ public abstract class BSPhysObject : PhysicsActor
public OMV.Vector3 LockedAxis { get; set; } // zero means locked. one means free.
public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(1f, 1f, 1f); // All axis are free
public readonly String LockedAxisActorName = "BSPrim.LockedAxis";
#region Collisions
@@ -413,6 +421,9 @@ public abstract class BSPhysObject : PhysicsActor
#endregion // Collisions
#region Per Simulation Step actions
public BSActorCollection PhysicalActors;
// There are some actions that must be performed for a physical object before each simulation step.
// These actions are optional so, rather than scanning all the physical objects and asking them
// if they have anything to do, a physical object registers for an event call before the step is performed.