From 03268d85c41c94e7b35802b9dea1ce08299e5426 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 2 Jun 2013 10:04:15 -0700 Subject: BulletSim: comments and non-functional changes working toward the center-of-gravity implementation. --- .../Region/Physics/BulletSPlugin/BSPrimLinkable.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index 87eed98..6d7de35 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs @@ -37,6 +37,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin { public class BSPrimLinkable : BSPrimDisplaced { + // The purpose of this subclass is to add linkset functionality to the prim. This overrides + // operations necessary for keeping the linkset created and, additionally, this + // calls the linkset implementation for its creation and management. + + // This adds the overrides for link() and delink() so the prim is linkable. + public BSLinkset Linkset { get; set; } // The index of this child prim. public int LinksetChildIndex { get; set; } @@ -69,8 +75,8 @@ public class BSPrimLinkable : BSPrimDisplaced BSPrimLinkable parent = obj as BSPrimLinkable; if (parent != null) { - BSPhysObject parentBefore = Linkset.LinksetRoot; - int childrenBefore = Linkset.NumberOfChildren; + BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG + int childrenBefore = Linkset.NumberOfChildren; // DEBUG Linkset = parent.Linkset.AddMeToLinkset(this); @@ -85,8 +91,8 @@ public class BSPrimLinkable : BSPrimDisplaced // TODO: decide if this parent checking needs to happen at taint time // Race condition here: if link() and delink() in same simulation tick, the delink will not happen - BSPhysObject parentBefore = Linkset.LinksetRoot; - int childrenBefore = Linkset.NumberOfChildren; + BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG + int childrenBefore = Linkset.NumberOfChildren; // DEBUG Linkset = Linkset.RemoveMeFromLinkset(this); @@ -128,6 +134,7 @@ public class BSPrimLinkable : BSPrimDisplaced get { return Linkset.LinksetMass; } } + // Refresh the linkset structure and parameters when the prim's physical parameters are changed. public override void UpdatePhysicalParameters() { base.UpdatePhysicalParameters(); @@ -139,6 +146,7 @@ public class BSPrimLinkable : BSPrimDisplaced Linkset.Refresh(this); } + // When the prim is made dynamic or static, the linkset needs to change. protected override void MakeDynamic(bool makeStatic) { base.MakeDynamic(makeStatic); @@ -155,6 +163,8 @@ public class BSPrimLinkable : BSPrimDisplaced base.RemoveDependencies(); } + // Called after a simulation step for the changes in physical object properties. + // Do any filtering/modification needed for linksets. public override void UpdateProperties(EntityProperties entprop) { if (Linkset.IsRoot(this)) @@ -176,6 +186,7 @@ public class BSPrimLinkable : BSPrimDisplaced Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); } + // Called after a simulation step to post a collision with this object. public override bool Collide(uint collidingWith, BSPhysObject collidee, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) { -- cgit v1.1