diff options
author | Robert Adams | 2013-06-02 10:04:15 -0700 |
---|---|---|
committer | Robert Adams | 2013-07-06 08:25:14 -0700 |
commit | 03268d85c41c94e7b35802b9dea1ce08299e5426 (patch) | |
tree | 67f18d3f8003f34f5d42004005e21723b7e5d689 /OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | |
parent | BulletSim: non-functional updates. Comments and formatting. (diff) | |
download | opensim-SC-03268d85c41c94e7b35802b9dea1ce08299e5426.zip opensim-SC-03268d85c41c94e7b35802b9dea1ce08299e5426.tar.gz opensim-SC-03268d85c41c94e7b35802b9dea1ce08299e5426.tar.bz2 opensim-SC-03268d85c41c94e7b35802b9dea1ce08299e5426.tar.xz |
BulletSim: comments and non-functional changes working toward the center-of-gravity implementation.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | 19 |
1 files changed, 15 insertions, 4 deletions
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 | |||
37 | { | 37 | { |
38 | public class BSPrimLinkable : BSPrimDisplaced | 38 | public class BSPrimLinkable : BSPrimDisplaced |
39 | { | 39 | { |
40 | // The purpose of this subclass is to add linkset functionality to the prim. This overrides | ||
41 | // operations necessary for keeping the linkset created and, additionally, this | ||
42 | // calls the linkset implementation for its creation and management. | ||
43 | |||
44 | // This adds the overrides for link() and delink() so the prim is linkable. | ||
45 | |||
40 | public BSLinkset Linkset { get; set; } | 46 | public BSLinkset Linkset { get; set; } |
41 | // The index of this child prim. | 47 | // The index of this child prim. |
42 | public int LinksetChildIndex { get; set; } | 48 | public int LinksetChildIndex { get; set; } |
@@ -69,8 +75,8 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
69 | BSPrimLinkable parent = obj as BSPrimLinkable; | 75 | BSPrimLinkable parent = obj as BSPrimLinkable; |
70 | if (parent != null) | 76 | if (parent != null) |
71 | { | 77 | { |
72 | BSPhysObject parentBefore = Linkset.LinksetRoot; | 78 | BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG |
73 | int childrenBefore = Linkset.NumberOfChildren; | 79 | int childrenBefore = Linkset.NumberOfChildren; // DEBUG |
74 | 80 | ||
75 | Linkset = parent.Linkset.AddMeToLinkset(this); | 81 | Linkset = parent.Linkset.AddMeToLinkset(this); |
76 | 82 | ||
@@ -85,8 +91,8 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
85 | // TODO: decide if this parent checking needs to happen at taint time | 91 | // TODO: decide if this parent checking needs to happen at taint time |
86 | // Race condition here: if link() and delink() in same simulation tick, the delink will not happen | 92 | // Race condition here: if link() and delink() in same simulation tick, the delink will not happen |
87 | 93 | ||
88 | BSPhysObject parentBefore = Linkset.LinksetRoot; | 94 | BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG |
89 | int childrenBefore = Linkset.NumberOfChildren; | 95 | int childrenBefore = Linkset.NumberOfChildren; // DEBUG |
90 | 96 | ||
91 | Linkset = Linkset.RemoveMeFromLinkset(this); | 97 | Linkset = Linkset.RemoveMeFromLinkset(this); |
92 | 98 | ||
@@ -128,6 +134,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
128 | get { return Linkset.LinksetMass; } | 134 | get { return Linkset.LinksetMass; } |
129 | } | 135 | } |
130 | 136 | ||
137 | // Refresh the linkset structure and parameters when the prim's physical parameters are changed. | ||
131 | public override void UpdatePhysicalParameters() | 138 | public override void UpdatePhysicalParameters() |
132 | { | 139 | { |
133 | base.UpdatePhysicalParameters(); | 140 | base.UpdatePhysicalParameters(); |
@@ -139,6 +146,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
139 | Linkset.Refresh(this); | 146 | Linkset.Refresh(this); |
140 | } | 147 | } |
141 | 148 | ||
149 | // When the prim is made dynamic or static, the linkset needs to change. | ||
142 | protected override void MakeDynamic(bool makeStatic) | 150 | protected override void MakeDynamic(bool makeStatic) |
143 | { | 151 | { |
144 | base.MakeDynamic(makeStatic); | 152 | base.MakeDynamic(makeStatic); |
@@ -155,6 +163,8 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
155 | base.RemoveDependencies(); | 163 | base.RemoveDependencies(); |
156 | } | 164 | } |
157 | 165 | ||
166 | // Called after a simulation step for the changes in physical object properties. | ||
167 | // Do any filtering/modification needed for linksets. | ||
158 | public override void UpdateProperties(EntityProperties entprop) | 168 | public override void UpdateProperties(EntityProperties entprop) |
159 | { | 169 | { |
160 | if (Linkset.IsRoot(this)) | 170 | if (Linkset.IsRoot(this)) |
@@ -176,6 +186,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
176 | Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); | 186 | Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); |
177 | } | 187 | } |
178 | 188 | ||
189 | // Called after a simulation step to post a collision with this object. | ||
179 | public override bool Collide(uint collidingWith, BSPhysObject collidee, | 190 | public override bool Collide(uint collidingWith, BSPhysObject collidee, |
180 | OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) | 191 | OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) |
181 | { | 192 | { |