diff options
author | BlueWall | 2012-12-03 20:17:00 -0500 |
---|---|---|
committer | BlueWall | 2012-12-03 20:17:00 -0500 |
commit | 0c7d6adef158d5cb25d8eb60287c5cb0cceaa953 (patch) | |
tree | f766959f3442b78aa9202a4f61cf127508245345 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | XmlRpcGridRouter (diff) | |
parent | BulletSim: Reduce idle region physics overhead where there are MANY (diff) | |
download | opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.zip opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.tar.gz opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.tar.bz2 opensim-SC_OLD-0c7d6adef158d5cb25d8eb60287c5cb0cceaa953.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 3fb0300..ea1f71a 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -348,7 +348,9 @@ public sealed class BSPrim : BSPhysObject | |||
348 | if (ret) | 348 | if (ret) |
349 | { | 349 | { |
350 | // Apply upforce and overcome gravity. | 350 | // Apply upforce and overcome gravity. |
351 | AddForce(upForce - PhysicsScene.DefaultGravity, false, inTaintTime); | 351 | OMV.Vector3 correctionForce = upForce - PhysicsScene.DefaultGravity; |
352 | DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce); | ||
353 | AddForce(correctionForce, false, inTaintTime); | ||
352 | } | 354 | } |
353 | return ret; | 355 | return ret; |
354 | } | 356 | } |
@@ -644,9 +646,13 @@ public sealed class BSPrim : BSPhysObject | |||
644 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); | 646 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); |
645 | 647 | ||
646 | // Collision filter can be set only when the object is in the world | 648 | // Collision filter can be set only when the object is in the world |
647 | if (PhysBody.collisionFilter != 0 || PhysBody.collisionMask != 0) | 649 | if (PhysBody.collisionGroup != 0 || PhysBody.collisionMask != 0) |
648 | { | 650 | { |
649 | BulletSimAPI.SetCollisionFilterMask2(PhysBody.ptr, (uint)PhysBody.collisionFilter, (uint)PhysBody.collisionMask); | 651 | if (!BulletSimAPI.SetCollisionGroupMask2(PhysBody.ptr, (uint)PhysBody.collisionGroup, (uint)PhysBody.collisionMask)) |
652 | { | ||
653 | PhysicsScene.Logger.ErrorFormat("{0} Failure setting prim collision mask. localID={1}, grp={2:X}, mask={3:X}", | ||
654 | LogHeader, LocalID, PhysBody.collisionGroup, PhysBody.collisionMask); | ||
655 | } | ||
650 | } | 656 | } |
651 | 657 | ||
652 | // Recompute any linkset parameters. | 658 | // Recompute any linkset parameters. |
@@ -685,11 +691,11 @@ public sealed class BSPrim : BSPhysObject | |||
685 | // There can be special things needed for implementing linksets | 691 | // There can be special things needed for implementing linksets |
686 | Linkset.MakeStatic(this); | 692 | Linkset.MakeStatic(this); |
687 | // The activation state is 'disabled' so Bullet will not try to act on it. | 693 | // The activation state is 'disabled' so Bullet will not try to act on it. |
688 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION); | 694 | // BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION); |
689 | // Start it out sleeping and physical actions could wake it up. | 695 | // Start it out sleeping and physical actions could wake it up. |
690 | // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING); | 696 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); |
691 | 697 | ||
692 | PhysBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter; | 698 | PhysBody.collisionGroup = CollisionFilterGroups.StaticObjectGroup; |
693 | PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask; | 699 | PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask; |
694 | } | 700 | } |
695 | else | 701 | else |
@@ -735,7 +741,7 @@ public sealed class BSPrim : BSPhysObject | |||
735 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); | 741 | BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); |
736 | // BulletSimAPI.Activate2(BSBody.ptr, true); | 742 | // BulletSimAPI.Activate2(BSBody.ptr, true); |
737 | 743 | ||
738 | PhysBody.collisionFilter = CollisionFilterGroups.ObjectFilter; | 744 | PhysBody.collisionGroup = CollisionFilterGroups.ObjectGroup; |
739 | PhysBody.collisionMask = CollisionFilterGroups.ObjectMask; | 745 | PhysBody.collisionMask = CollisionFilterGroups.ObjectMask; |
740 | } | 746 | } |
741 | } | 747 | } |
@@ -763,7 +769,7 @@ public sealed class BSPrim : BSPhysObject | |||
763 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); | 769 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); |
764 | } | 770 | } |
765 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 771 | CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
766 | PhysBody.collisionFilter = CollisionFilterGroups.VolumeDetectFilter; | 772 | PhysBody.collisionGroup = CollisionFilterGroups.VolumeDetectGroup; |
767 | PhysBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; | 773 | PhysBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; |
768 | } | 774 | } |
769 | } | 775 | } |
@@ -839,15 +845,6 @@ public sealed class BSPrim : BSPhysObject | |||
839 | } | 845 | } |
840 | public override OMV.Vector3 RotationalVelocity { | 846 | public override OMV.Vector3 RotationalVelocity { |
841 | get { | 847 | get { |
842 | /* | ||
843 | OMV.Vector3 pv = OMV.Vector3.Zero; | ||
844 | // if close to zero, report zero | ||
845 | // This is copied from ODE but I'm not sure why it returns zero but doesn't | ||
846 | // zero the property in the physics engine. | ||
847 | if (_rotationalVelocity.ApproxEquals(pv, 0.2f)) | ||
848 | return pv; | ||
849 | */ | ||
850 | |||
851 | return _rotationalVelocity; | 848 | return _rotationalVelocity; |
852 | } | 849 | } |
853 | set { | 850 | set { |
@@ -1409,7 +1406,7 @@ public sealed class BSPrim : BSPhysObject | |||
1409 | LastEntityProperties = CurrentEntityProperties; | 1406 | LastEntityProperties = CurrentEntityProperties; |
1410 | CurrentEntityProperties = entprop; | 1407 | CurrentEntityProperties = entprop; |
1411 | 1408 | ||
1412 | OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; | 1409 | OMV.Vector3 direction = OMV.Vector3.UnitX * _orientation; // DEBUG DEBUG DEBUG |
1413 | DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", | 1410 | DetailLog("{0},BSPrim.UpdateProperties,call,pos={1},orient={2},dir={3},vel={4},rotVel={5}", |
1414 | LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity); | 1411 | LocalID, _position, _orientation, direction, _velocity, _rotationalVelocity); |
1415 | 1412 | ||