diff options
Diffstat (limited to '')
4 files changed, 43 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index b9c2cf9..1f7c398 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -59,7 +59,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
59 | // refresh will happen once after all the other taints are applied. | 59 | // refresh will happen once after all the other taints are applied. |
60 | public override void Refresh(BSPhysObject requestor) | 60 | public override void Refresh(BSPhysObject requestor) |
61 | { | 61 | { |
62 | // External request for Refresh (from BSPrim) is not necessary | 62 | // External request for Refresh (from BSPrim) doesn't need to do anything |
63 | // InternalRefresh(requestor); | 63 | // InternalRefresh(requestor); |
64 | } | 64 | } |
65 | 65 | ||
@@ -86,7 +86,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
86 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); | 86 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
87 | if (!IsRoot(child)) | 87 | if (!IsRoot(child)) |
88 | { | 88 | { |
89 | // Physical children are removed from the world as the shape ofthe root compound | 89 | // The origional prims are removed from the world as the shape of the root compound |
90 | // shape takes over. | 90 | // shape takes over. |
91 | BulletSimAPI.AddToCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 91 | BulletSimAPI.AddToCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
92 | BulletSimAPI.ForceActivationState2(child.PhysBody.ptr, ActivationState.DISABLE_SIMULATION); | 92 | BulletSimAPI.ForceActivationState2(child.PhysBody.ptr, ActivationState.DISABLE_SIMULATION); |
@@ -118,7 +118,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
118 | // Called at taint-time!! | 118 | // Called at taint-time!! |
119 | public override void UpdateProperties(BSPhysObject updated) | 119 | public override void UpdateProperties(BSPhysObject updated) |
120 | { | 120 | { |
121 | // Nothing to do for constraints on property updates | 121 | // Nothing to do for compound linksets on property updates |
122 | } | 122 | } |
123 | 123 | ||
124 | // The children move around in relationship to the root. | 124 | // The children move around in relationship to the root. |
@@ -257,6 +257,11 @@ public sealed class BSLinksetCompound : BSLinkset | |||
257 | BulletSimAPI.AddChildShapeToCompoundShape2(LinksetRoot.PhysShape.ptr, cPrim.PhysShape.ptr, displacementPos, displacementRot); | 257 | BulletSimAPI.AddChildShapeToCompoundShape2(LinksetRoot.PhysShape.ptr, cPrim.PhysShape.ptr, displacementPos, displacementRot); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | |||
261 | // TODO: need to phantomize the child prims left behind. | ||
262 | // Maybe just destroy the children bodies and shapes and have them rebuild on unlink. | ||
263 | // Selection/deselection might cause way too many build/destructions esp. for LARGE linksets. | ||
264 | |||
260 | return false; // 'false' says to move onto the next child in the list | 265 | return false; // 'false' says to move onto the next child in the list |
261 | }); | 266 | }); |
262 | 267 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 62aaf80..4d203ff 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -190,12 +190,15 @@ public sealed class BSPrim : BSPhysObject | |||
190 | } | 190 | } |
191 | public override bool Selected { | 191 | public override bool Selected { |
192 | set { | 192 | set { |
193 | _isSelected = value; | 193 | if (value != _isSelected) |
194 | PhysicsScene.TaintedObject("BSPrim.setSelected", delegate() | ||
195 | { | 194 | { |
196 | DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); | 195 | _isSelected = value; |
197 | SetObjectDynamic(false); | 196 | PhysicsScene.TaintedObject("BSPrim.setSelected", delegate() |
198 | }); | 197 | { |
198 | DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); | ||
199 | SetObjectDynamic(false); | ||
200 | }); | ||
201 | } | ||
199 | } | 202 | } |
200 | } | 203 | } |
201 | public override void CrossingFailure() { return; } | 204 | public override void CrossingFailure() { return; } |
@@ -678,8 +681,11 @@ public sealed class BSPrim : BSPhysObject | |||
678 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); | 681 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); |
679 | // Stop all movement | 682 | // Stop all movement |
680 | ZeroMotion(true); | 683 | ZeroMotion(true); |
681 | // Center of mass is at the center of the object | 684 | |
682 | // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation); | 685 | // Set various physical properties so other object interact properly |
686 | BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction); | ||
687 | BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution); | ||
688 | |||
683 | // Mass is zero which disables a bunch of physics stuff in Bullet | 689 | // Mass is zero which disables a bunch of physics stuff in Bullet |
684 | UpdatePhysicalMassProperties(0f); | 690 | UpdatePhysicalMassProperties(0f); |
685 | // Set collision detection parameters | 691 | // Set collision detection parameters |
@@ -688,13 +694,15 @@ public sealed class BSPrim : BSPhysObject | |||
688 | BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold); | 694 | BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold); |
689 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); | 695 | BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); |
690 | } | 696 | } |
691 | // There can be special things needed for implementing linksets | 697 | |
692 | Linkset.MakeStatic(this); | ||
693 | // The activation state is 'disabled' so Bullet will not try to act on it. | 698 | // The activation state is 'disabled' so Bullet will not try to act on it. |
694 | // BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION); | 699 | // BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION); |
695 | // Start it out sleeping and physical actions could wake it up. | 700 | // Start it out sleeping and physical actions could wake it up. |
696 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); | 701 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); |
697 | 702 | ||
703 | // There can be special things needed for implementing linksets | ||
704 | Linkset.MakeStatic(this); | ||
705 | |||
698 | PhysBody.collisionGroup = CollisionFilterGroups.StaticObjectGroup; | 706 | PhysBody.collisionGroup = CollisionFilterGroups.StaticObjectGroup; |
699 | PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask; | 707 | PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask; |
700 | } | 708 | } |
@@ -1326,7 +1334,7 @@ public sealed class BSPrim : BSPhysObject | |||
1326 | // Rebuild the geometry and object. | 1334 | // Rebuild the geometry and object. |
1327 | // This is called when the shape changes so we need to recreate the mesh/hull. | 1335 | // This is called when the shape changes so we need to recreate the mesh/hull. |
1328 | // Called at taint-time!!! | 1336 | // Called at taint-time!!! |
1329 | private void CreateGeomAndObject(bool forceRebuild) | 1337 | public void CreateGeomAndObject(bool forceRebuild) |
1330 | { | 1338 | { |
1331 | // If this prim is part of a linkset, we must remove and restore the physical | 1339 | // If this prim is part of a linkset, we must remove and restore the physical |
1332 | // links if the body is rebuilt. | 1340 | // links if the body is rebuilt. |
@@ -1341,7 +1349,7 @@ public sealed class BSPrim : BSPhysObject | |||
1341 | { | 1349 | { |
1342 | // Called if the current prim body is about to be destroyed. | 1350 | // Called if the current prim body is about to be destroyed. |
1343 | // Remove all the physical dependencies on the old body. | 1351 | // Remove all the physical dependencies on the old body. |
1344 | // (Maybe someday make the changing of BSShape an event handled by BSLinkset.) | 1352 | // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...) |
1345 | needToRestoreLinkset = Linkset.RemoveBodyDependencies(this); | 1353 | needToRestoreLinkset = Linkset.RemoveBodyDependencies(this); |
1346 | needToRestoreVehicle = _vehicle.RemoveBodyDependencies(this); | 1354 | needToRestoreVehicle = _vehicle.RemoveBodyDependencies(this); |
1347 | }); | 1355 | }); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index a5e5754..a77dee9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -415,7 +415,7 @@ public sealed class BSShapeCollection : IDisposable | |||
415 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE) | 415 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE) |
416 | { | 416 | { |
417 | // an avatar capsule is close to a native shape (it is not shared) | 417 | // an avatar capsule is close to a native shape (it is not shared) |
418 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE, | 418 | GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE, |
419 | FixedShapeKey.KEY_CAPSULE, shapeCallback); | 419 | FixedShapeKey.KEY_CAPSULE, shapeCallback); |
420 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); | 420 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); |
421 | ret = true; | 421 | ret = true; |
@@ -423,7 +423,7 @@ public sealed class BSShapeCollection : IDisposable | |||
423 | } | 423 | } |
424 | 424 | ||
425 | // Compound shapes are handled special as they are rebuilt from scratch. | 425 | // Compound shapes are handled special as they are rebuilt from scratch. |
426 | // This isn't too great a hardship since most of the child shapes will already been created. | 426 | // This isn't too great a hardship since most of the child shapes will have already been created. |
427 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND) | 427 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND) |
428 | { | 428 | { |
429 | ret = GetReferenceToCompoundShape(prim, shapeCallback); | 429 | ret = GetReferenceToCompoundShape(prim, shapeCallback); |
@@ -460,6 +460,9 @@ public sealed class BSShapeCollection : IDisposable | |||
460 | && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 | 460 | && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 |
461 | && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) | 461 | && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) |
462 | { | 462 | { |
463 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", | ||
464 | prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); | ||
465 | |||
463 | // It doesn't look like Bullet scales spheres so make sure the scales are all equal | 466 | // It doesn't look like Bullet scales spheres so make sure the scales are all equal |
464 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) | 467 | if ((pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) |
465 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) | 468 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z) |
@@ -538,6 +541,8 @@ public sealed class BSShapeCollection : IDisposable | |||
538 | if (DDetail) DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", | 541 | if (DDetail) DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", |
539 | prim.LocalID, newShape, prim.Scale); | 542 | prim.LocalID, newShape, prim.Scale); |
540 | 543 | ||
544 | // native shapes are scaled by Bullet | ||
545 | prim.Scale = prim.Size; | ||
541 | prim.PhysShape = newShape; | 546 | prim.PhysShape = newShape; |
542 | return true; | 547 | return true; |
543 | } | 548 | } |
@@ -550,8 +555,8 @@ public sealed class BSShapeCollection : IDisposable | |||
550 | ShapeData nativeShapeData = new ShapeData(); | 555 | ShapeData nativeShapeData = new ShapeData(); |
551 | nativeShapeData.Type = shapeType; | 556 | nativeShapeData.Type = shapeType; |
552 | nativeShapeData.ID = prim.LocalID; | 557 | nativeShapeData.ID = prim.LocalID; |
553 | nativeShapeData.Scale = prim.Scale; | 558 | nativeShapeData.Scale = prim.Size; |
554 | nativeShapeData.Size = prim.Scale; // unneeded, I think. | 559 | nativeShapeData.Size = prim.Size; // unneeded, I think. |
555 | nativeShapeData.MeshKey = (ulong)shapeKey; | 560 | nativeShapeData.MeshKey = (ulong)shapeKey; |
556 | nativeShapeData.HullKey = (ulong)shapeKey; | 561 | nativeShapeData.HullKey = (ulong)shapeKey; |
557 | 562 | ||
@@ -566,8 +571,6 @@ public sealed class BSShapeCollection : IDisposable | |||
566 | else | 571 | else |
567 | { | 572 | { |
568 | // Native shapes are scaled in Bullet so set the scaling to the size | 573 | // Native shapes are scaled in Bullet so set the scaling to the size |
569 | prim.Scale = prim.Size; | ||
570 | nativeShapeData.Scale = prim.Scale; | ||
571 | newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType); | 574 | newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType); |
572 | } | 575 | } |
573 | if (newShape.ptr == IntPtr.Zero) | 576 | if (newShape.ptr == IntPtr.Zero) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index d51003c..a2161c3 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -5,6 +5,9 @@ CRASHES | |||
5 | 20121128.1600: mesh object not rezzing (no physics mesh). | 5 | 20121128.1600: mesh object not rezzing (no physics mesh). |
6 | Causes many errors. Doesn't stop after first error with box shape. | 6 | Causes many errors. Doesn't stop after first error with box shape. |
7 | Eventually crashes when deleting the object. | 7 | Eventually crashes when deleting the object. |
8 | 20121206.1434: rez Sam-pan into OSGrid BulletSim11 region | ||
9 | Immediate simulator crash. Mono does not output any stacktrace and | ||
10 | log just stops after reporting taint-time linking of the linkset. | ||
8 | 11 | ||
9 | VEHICLES TODO LIST: | 12 | VEHICLES TODO LIST: |
10 | ================================================= | 13 | ================================================= |
@@ -23,9 +26,12 @@ After getting off a vehicle, the root prim is phantom (can be walked through) | |||
23 | Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) | 26 | Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint) |
24 | Implement referenceFrame for all the motion routines. | 27 | Implement referenceFrame for all the motion routines. |
25 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. | 28 | Cannot edit/move a vehicle being ridden: it jumps back to the origional position. |
29 | Border crossing with linked vehicle causes crash | ||
26 | 30 | ||
27 | BULLETSIM TODO LIST: | 31 | BULLETSIM TODO LIST: |
28 | ================================================= | 32 | ================================================= |
33 | Duplicating a physical prim causes old prim to jump away | ||
34 | Dup a phys prim and the original become unselected and thus interacts w/ selected prim. | ||
29 | Disable activity of passive linkset children. | 35 | Disable activity of passive linkset children. |
30 | Since the linkset is a compound object, the old prims are left lying | 36 | Since the linkset is a compound object, the old prims are left lying |
31 | around and need to be phantomized so they don't collide, ... | 37 | around and need to be phantomized so they don't collide, ... |
@@ -96,7 +102,7 @@ Breakout code for mesh/hull/compound/native into separate BSShape* classes | |||
96 | Generalize Dynamics and PID with standardized motors. | 102 | Generalize Dynamics and PID with standardized motors. |
97 | Generalize Linkset and vehicles into PropertyManagers | 103 | Generalize Linkset and vehicles into PropertyManagers |
98 | Methods for Refresh, RemoveBodyDependencies, RestoreBodyDependencies | 104 | Methods for Refresh, RemoveBodyDependencies, RestoreBodyDependencies |
99 | Possibly generalized a 'pre step action' registration. | 105 | Potentially add events for shape destruction, etc. |
100 | Complete implemention of preStepActions | 106 | Complete implemention of preStepActions |
101 | Replace vehicle step call with prestep event. | 107 | Replace vehicle step call with prestep event. |
102 | Is there a need for postStepActions? postStepTaints? | 108 | Is there a need for postStepActions? postStepTaints? |