diff options
author | Robert Adams | 2012-12-08 09:12:45 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-08 09:14:40 -0800 |
commit | 04e64d73dfddf9ef3e3716f6c43752c6f63438cb (patch) | |
tree | 4bfc555b52f23d8b65fb3b20242f124eb73b7da5 /OpenSim | |
parent | BulletSim: fix small problem with setting size/scale of native shapes which c... (diff) | |
download | opensim-SC_OLD-04e64d73dfddf9ef3e3716f6c43752c6f63438cb.zip opensim-SC_OLD-04e64d73dfddf9ef3e3716f6c43752c6f63438cb.tar.gz opensim-SC_OLD-04e64d73dfddf9ef3e3716f6c43752c6f63438cb.tar.bz2 opensim-SC_OLD-04e64d73dfddf9ef3e3716f6c43752c6f63438cb.tar.xz |
BulletSim: set material properties for static objects. Move Linkset.MakeStatic() after call to ForceActivationState2() since linkset might change activation state. Make BSPrim.CreateGeomAndObject public as linkset rebuilding might need access to it. Only rebuild prim if selection state is actually changes -- OpenSimulator calls PhysObject.Selected() multiple times whenever a prim is selected or deselected.
Diffstat (limited to 'OpenSim')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 30 |
2 files changed, 24 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 492c7b1..1f7c398 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -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 | }); |