aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs50
1 files changed, 27 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 0df4310..756faed 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -32,6 +32,15 @@ using OMV = OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.BulletSPlugin 33namespace OpenSim.Region.Physics.BulletSPlugin
34{ 34{
35
36// A BSPrim can get individual information about its linkedness attached
37// to it through an instance of a subclass of LinksetInfo.
38// Each type of linkset will define the information needed for its type.
39public abstract class BSLinksetInfo
40{
41 public virtual void Clear() { }
42}
43
35public abstract class BSLinkset 44public abstract class BSLinkset
36{ 45{
37 // private static string LogHeader = "[BULLETSIM LINKSET]"; 46 // private static string LogHeader = "[BULLETSIM LINKSET]";
@@ -47,7 +56,7 @@ public abstract class BSLinkset
47 { 56 {
48 BSLinkset ret = null; 57 BSLinkset ret = null;
49 58
50 switch ((int)physScene.Params.linksetImplementation) 59 switch ((int)BSParam.LinksetImplementation)
51 { 60 {
52 case (int)LinksetImplementation.Constraint: 61 case (int)LinksetImplementation.Constraint:
53 ret = new BSLinksetConstraints(physScene, parent); 62 ret = new BSLinksetConstraints(physScene, parent);
@@ -87,22 +96,8 @@ public abstract class BSLinkset
87 return BSPhysicsShapeType.SHAPE_UNKNOWN; 96 return BSPhysicsShapeType.SHAPE_UNKNOWN;
88 } 97 }
89 98
90 // Linksets move around the children so the linkset might need to compute the child position
91 public virtual OMV.Vector3 Position(BSPhysObject member)
92 { return member.RawPosition; }
93 public virtual OMV.Quaternion Orientation(BSPhysObject member)
94 { return member.RawOrientation; }
95 // TODO: does this need to be done for Velocity and RotationalVelocityy?
96
97 // We keep the prim's mass in the linkset structure since it could be dependent on other prims 99 // We keep the prim's mass in the linkset structure since it could be dependent on other prims
98 protected float m_mass; 100 public float LinksetMass { get; protected set; }
99 public float LinksetMass
100 {
101 get
102 {
103 return m_mass;
104 }
105 }
106 101
107 public virtual bool LinksetIsColliding { get { return false; } } 102 public virtual bool LinksetIsColliding { get { return false; } }
108 103
@@ -116,7 +111,7 @@ public abstract class BSLinkset
116 get { return ComputeLinksetGeometricCenter(); } 111 get { return ComputeLinksetGeometricCenter(); }
117 } 112 }
118 113
119 protected void Initialize(BSScene scene, BSPhysObject parent) 114 protected BSLinkset(BSScene scene, BSPhysObject parent)
120 { 115 {
121 // A simple linkset of one (no children) 116 // A simple linkset of one (no children)
122 LinksetID = m_nextLinksetID++; 117 LinksetID = m_nextLinksetID++;
@@ -126,7 +121,8 @@ public abstract class BSLinkset
126 PhysicsScene = scene; 121 PhysicsScene = scene;
127 LinksetRoot = parent; 122 LinksetRoot = parent;
128 m_children = new HashSet<BSPhysObject>(); 123 m_children = new HashSet<BSPhysObject>();
129 m_mass = parent.RawMass; 124 LinksetMass = parent.RawMass;
125 Rebuilding = false;
130 } 126 }
131 127
132 // Link to a linkset where the child knows the parent. 128 // Link to a linkset where the child knows the parent.
@@ -140,7 +136,7 @@ public abstract class BSLinkset
140 // Don't add the root to its own linkset 136 // Don't add the root to its own linkset
141 if (!IsRoot(child)) 137 if (!IsRoot(child))
142 AddChildToLinkset(child); 138 AddChildToLinkset(child);
143 m_mass = ComputeLinksetMass(); 139 LinksetMass = ComputeLinksetMass();
144 } 140 }
145 return this; 141 return this;
146 } 142 }
@@ -159,7 +155,7 @@ public abstract class BSLinkset
159 return this; 155 return this;
160 } 156 }
161 RemoveChildFromLinkset(child); 157 RemoveChildFromLinkset(child);
162 m_mass = ComputeLinksetMass(); 158 LinksetMass = ComputeLinksetMass();
163 } 159 }
164 160
165 // The child is down to a linkset of just itself 161 // The child is down to a linkset of just itself
@@ -219,7 +215,7 @@ public abstract class BSLinkset
219 // I am the root of a linkset and a new child is being added 215 // I am the root of a linkset and a new child is being added
220 // Called while LinkActivity is locked. 216 // Called while LinkActivity is locked.
221 protected abstract void AddChildToLinkset(BSPhysObject child); 217 protected abstract void AddChildToLinkset(BSPhysObject child);
222 218
223 // I am the root of a linkset and one of my children is being removed. 219 // I am the root of a linkset and one of my children is being removed.
224 // Safe to call even if the child is not really in my linkset. 220 // Safe to call even if the child is not really in my linkset.
225 protected abstract void RemoveChildFromLinkset(BSPhysObject child); 221 protected abstract void RemoveChildFromLinkset(BSPhysObject child);
@@ -227,7 +223,14 @@ public abstract class BSLinkset
227 // When physical properties are changed the linkset needs to recalculate 223 // When physical properties are changed the linkset needs to recalculate
228 // its internal properties. 224 // its internal properties.
229 // May be called at runtime or taint-time. 225 // May be called at runtime or taint-time.
230 public abstract void Refresh(BSPhysObject requestor); 226 public virtual void Refresh(BSPhysObject requestor)
227 {
228 LinksetMass = ComputeLinksetMass();
229 }
230
231 // Flag denoting the linkset is in the process of being rebuilt.
232 // Used to know not the schedule a rebuild in the middle of a rebuild.
233 protected bool Rebuilding { get; set; }
231 234
232 // The object is going dynamic (physical). Do any setup necessary 235 // The object is going dynamic (physical). Do any setup necessary
233 // for a dynamic linkset. 236 // for a dynamic linkset.
@@ -245,8 +248,9 @@ public abstract class BSLinkset
245 248
246 // Called when a parameter update comes from the physics engine for any object 249 // Called when a parameter update comes from the physics engine for any object
247 // of the linkset is received. 250 // of the linkset is received.
251 // Passed flag is update came from physics engine (true) or the user (false).
248 // Called at taint-time!! 252 // Called at taint-time!!
249 public abstract void UpdateProperties(BSPhysObject physObject); 253 public abstract void UpdateProperties(BSPhysObject physObject, bool physicalUpdate);
250 254
251 // Routine used when rebuilding the body of the root of the linkset 255 // Routine used when rebuilding the body of the root of the linkset
252 // Destroy all the constraints have have been made to root. 256 // Destroy all the constraints have have been made to root.