diff options
5 files changed, 31 insertions, 45 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index ce0fbe6..2486be5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -38,6 +38,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
38 | // Each type of linkset will define the information needed for its type. | 38 | // Each type of linkset will define the information needed for its type. |
39 | public abstract class BSLinksetInfo | 39 | public abstract class BSLinksetInfo |
40 | { | 40 | { |
41 | public virtual void Clear() { } | ||
41 | } | 42 | } |
42 | 43 | ||
43 | public abstract class BSLinkset | 44 | public abstract class BSLinkset |
@@ -95,13 +96,6 @@ public abstract class BSLinkset | |||
95 | return BSPhysicsShapeType.SHAPE_UNKNOWN; | 96 | return BSPhysicsShapeType.SHAPE_UNKNOWN; |
96 | } | 97 | } |
97 | 98 | ||
98 | // Linksets move around the children so the linkset might need to compute the child position | ||
99 | public virtual OMV.Vector3 Position(BSPhysObject member) | ||
100 | { return member.RawPosition; } | ||
101 | public virtual OMV.Quaternion Orientation(BSPhysObject member) | ||
102 | { return member.RawOrientation; } | ||
103 | // TODO: does this need to be done for Velocity and RotationalVelocityy? | ||
104 | |||
105 | // 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 |
106 | protected float m_mass; | 100 | protected float m_mass; |
107 | public float LinksetMass | 101 | public float LinksetMass |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 2189468..8359607 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -45,6 +45,11 @@ sealed class BSLinksetCompoundInfo : BSLinksetInfo | |||
45 | OffsetPos = p; | 45 | OffsetPos = p; |
46 | OffsetRot = r; | 46 | OffsetRot = r; |
47 | } | 47 | } |
48 | public override void Clear() | ||
49 | { | ||
50 | OffsetPos = OMV.Vector3.Zero; | ||
51 | OffsetRot = OMV.Quaternion.Identity; | ||
52 | } | ||
48 | public override string ToString() | 53 | public override string ToString() |
49 | { | 54 | { |
50 | StringBuilder buff = new StringBuilder(); | 55 | StringBuilder buff = new StringBuilder(); |
@@ -82,8 +87,11 @@ public sealed class BSLinksetCompound : BSLinkset | |||
82 | // its internal properties. | 87 | // its internal properties. |
83 | public override void Refresh(BSPhysObject requestor) | 88 | public override void Refresh(BSPhysObject requestor) |
84 | { | 89 | { |
85 | // External request for Refresh (from BSPrim) doesn't need to do anything | 90 | if (!IsRoot(requestor)) |
86 | // InternalRefresh(requestor); | 91 | { |
92 | } | ||
93 | // Something changed so do the rebuilding thing | ||
94 | InternalRefresh(requestor); | ||
87 | } | 95 | } |
88 | 96 | ||
89 | // Schedule a refresh to happen after all the other taint processing. | 97 | // Schedule a refresh to happen after all the other taint processing. |
@@ -170,18 +178,6 @@ public sealed class BSLinksetCompound : BSLinkset | |||
170 | // Nothing to do for compound linksets on property updates | 178 | // Nothing to do for compound linksets on property updates |
171 | } | 179 | } |
172 | 180 | ||
173 | // The children move around in relationship to the root. | ||
174 | // Just grab the current values of wherever it is right now. | ||
175 | public override OMV.Vector3 Position(BSPhysObject member) | ||
176 | { | ||
177 | return BulletSimAPI.GetPosition2(member.PhysBody.ptr); | ||
178 | } | ||
179 | |||
180 | public override OMV.Quaternion Orientation(BSPhysObject member) | ||
181 | { | ||
182 | return BulletSimAPI.GetOrientation2(member.PhysBody.ptr); | ||
183 | } | ||
184 | |||
185 | // Routine called when rebuilding the body of some member of the linkset. | 181 | // Routine called when rebuilding the body of some member of the linkset. |
186 | // Since we don't keep in world relationships, do nothing unless it's a child changing. | 182 | // Since we don't keep in world relationships, do nothing unless it's a child changing. |
187 | // Returns 'true' of something was actually removed and would need restoring | 183 | // Returns 'true' of something was actually removed and would need restoring |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index 732c084..7076ab4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -83,18 +83,6 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
83 | // Nothing to do for constraints on property updates | 83 | // Nothing to do for constraints on property updates |
84 | } | 84 | } |
85 | 85 | ||
86 | // The children of the linkset are moved around by the constraints. | ||
87 | // Just grab the current values of wherever it is right now. | ||
88 | public override OMV.Vector3 Position(BSPhysObject member) | ||
89 | { | ||
90 | return BulletSimAPI.GetPosition2(member.PhysBody.ptr); | ||
91 | } | ||
92 | |||
93 | public override OMV.Quaternion Orientation(BSPhysObject member) | ||
94 | { | ||
95 | return BulletSimAPI.GetOrientation2(member.PhysBody.ptr); | ||
96 | } | ||
97 | |||
98 | // Routine called when rebuilding the body of some member of the linkset. | 86 | // Routine called when rebuilding the body of some member of the linkset. |
99 | // Destroy all the constraints have have been made to root and set | 87 | // Destroy all the constraints have have been made to root and set |
100 | // up to rebuild the constraints before the next simulation step. | 88 | // up to rebuild the constraints before the next simulation step. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index c9c9c2c..53be2e3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -279,9 +279,12 @@ public sealed class BSPrim : BSPhysObject | |||
279 | } | 279 | } |
280 | public override OMV.Vector3 Position { | 280 | public override OMV.Vector3 Position { |
281 | get { | 281 | get { |
282 | /* NOTE: this refetch is not necessary. The simulator knows about linkset children | ||
283 | * and does not fetch this position info for children. Thus this is commented out. | ||
282 | // child prims move around based on their parent. Need to get the latest location | 284 | // child prims move around based on their parent. Need to get the latest location |
283 | if (!Linkset.IsRoot(this)) | 285 | if (!Linkset.IsRoot(this)) |
284 | _position = Linkset.Position(this); | 286 | _position = Linkset.PositionGet(this); |
287 | */ | ||
285 | 288 | ||
286 | // don't do the GetObjectPosition for root elements because this function is called a zillion times. | 289 | // don't do the GetObjectPosition for root elements because this function is called a zillion times. |
287 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); | 290 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); |
@@ -289,21 +292,18 @@ public sealed class BSPrim : BSPhysObject | |||
289 | } | 292 | } |
290 | set { | 293 | set { |
291 | // If the position must be forced into the physics engine, use ForcePosition. | 294 | // If the position must be forced into the physics engine, use ForcePosition. |
295 | // All positions are given in world positions. | ||
292 | if (_position == value) | 296 | if (_position == value) |
293 | { | 297 | { |
298 | DetailLog("{0},BSPrim.setPosition,taint,positionNotChanging,pos={1},orient={2}", LocalID, _position, _orientation); | ||
294 | return; | 299 | return; |
295 | } | 300 | } |
296 | _position = value; | 301 | _position = value; |
297 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? | ||
298 | PositionSanityCheck(false); | 302 | PositionSanityCheck(false); |
299 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() | 303 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() |
300 | { | 304 | { |
301 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 305 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
302 | if (PhysBody.HasPhysicalBody) | 306 | ForcePosition = _position; |
303 | { | ||
304 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); | ||
305 | ActivateIfPhysical(false); | ||
306 | } | ||
307 | }); | 307 | }); |
308 | } | 308 | } |
309 | } | 309 | } |
@@ -314,9 +314,11 @@ public sealed class BSPrim : BSPhysObject | |||
314 | } | 314 | } |
315 | set { | 315 | set { |
316 | _position = value; | 316 | _position = value; |
317 | // PositionSanityCheck(); // Don't do this! Causes a loop and caller should know better. | 317 | if (PhysBody.HasPhysicalBody) |
318 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); | 318 | { |
319 | ActivateIfPhysical(false); | 319 | BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); |
320 | ActivateIfPhysical(false); | ||
321 | } | ||
320 | } | 322 | } |
321 | } | 323 | } |
322 | 324 | ||
@@ -551,11 +553,14 @@ public sealed class BSPrim : BSPhysObject | |||
551 | } | 553 | } |
552 | public override OMV.Quaternion Orientation { | 554 | public override OMV.Quaternion Orientation { |
553 | get { | 555 | get { |
556 | /* NOTE: this refetch is not necessary. The simulator knows about linkset children | ||
557 | * and does not fetch this position info for children. Thus this is commented out. | ||
554 | // Children move around because tied to parent. Get a fresh value. | 558 | // Children move around because tied to parent. Get a fresh value. |
555 | if (!Linkset.IsRoot(this)) | 559 | if (!Linkset.IsRoot(this)) |
556 | { | 560 | { |
557 | _orientation = Linkset.Orientation(this); | 561 | _orientation = Linkset.OrientationGet(this); |
558 | } | 562 | } |
563 | */ | ||
559 | return _orientation; | 564 | return _orientation; |
560 | } | 565 | } |
561 | set { | 566 | set { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 7d6ace8..9b89f0b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -37,6 +37,7 @@ Border crossing with linked vehicle causes crash | |||
37 | 37 | ||
38 | BULLETSIM TODO LIST: | 38 | BULLETSIM TODO LIST: |
39 | ================================================= | 39 | ================================================= |
40 | Revisit CollisionMargin. Builders notice the 0.04 spacing between prims. | ||
40 | Avatar height off after unsitting (floats off ground) | 41 | Avatar height off after unsitting (floats off ground) |
41 | Editting appearance then moving restores. | 42 | Editting appearance then moving restores. |
42 | Must not be initializing height when recreating capsule after unsit. | 43 | Must not be initializing height when recreating capsule after unsit. |
@@ -64,6 +65,8 @@ Implement ShapeCollection.Dispose() | |||
64 | Implement water as a plain so raycasting and collisions can happen with same. | 65 | Implement water as a plain so raycasting and collisions can happen with same. |
65 | Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE | 66 | Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE |
66 | Also osGetPhysicsEngineVerion() maybe. | 67 | Also osGetPhysicsEngineVerion() maybe. |
68 | Linkset.Position and Linkset.Orientation requre rewrite to properly return | ||
69 | child position. LinksetConstraint acts like it's at taint time!! | ||
67 | 70 | ||
68 | LINKSETS | 71 | LINKSETS |
69 | ====================================================== | 72 | ====================================================== |