diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 321 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 20 |
10 files changed, 293 insertions, 124 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f6e3d82..a20e466 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -120,8 +120,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
120 | 120 | ||
121 | private int m_update_physics = 1; | 121 | private int m_update_physics = 1; |
122 | private int m_update_entitymovement = 1; | 122 | private int m_update_entitymovement = 1; |
123 | private int m_update_entities = 20; // Run through all objects checking for updates | 123 | private int m_update_entities = 1; // Run through all objects checking for updates |
124 | private int m_update_entitiesquick = 1; // Run through objects that have scheduled updates checking for updates | 124 | private int m_update_entitiesquick = 200; // Run through objects that have scheduled updates checking for updates |
125 | private int m_update_presences = 1; // Update scene presence movements | 125 | private int m_update_presences = 1; // Update scene presence movements |
126 | private int m_update_events = 1; | 126 | private int m_update_events = 1; |
127 | private int m_update_backup = 200; | 127 | private int m_update_backup = 200; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 801e614..713c3ba 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1758,10 +1758,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1758 | { | 1758 | { |
1759 | lock (m_parts) | 1759 | lock (m_parts) |
1760 | { | 1760 | { |
1761 | m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); | ||
1761 | foreach (SceneObjectPart part in m_parts.Values) | 1762 | foreach (SceneObjectPart part in m_parts.Values) |
1762 | { | 1763 | { |
1763 | part.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); | 1764 | if (part.LocalID != m_rootPart.LocalID) |
1764 | 1765 | { | |
1766 | part.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); | ||
1767 | } | ||
1765 | // Hack to get the physics scene geometries in the right spot | 1768 | // Hack to get the physics scene geometries in the right spot |
1766 | ResetChildPrimPhysicsPositions(); | 1769 | ResetChildPrimPhysicsPositions(); |
1767 | 1770 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 6da4c3e..04fa03e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1306,9 +1306,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1306 | 1306 | ||
1307 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | 1307 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; |
1308 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; | 1308 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; |
1309 | PhysActor.delink(); | ||
1309 | } | 1310 | } |
1310 | 1311 | ||
1311 | PhysActor.IsPhysical = UsePhysics; | 1312 | PhysActor.IsPhysical = UsePhysics; |
1313 | |||
1314 | |||
1312 | // If we're not what we're supposed to be in the physics scene, recreate ourselves. | 1315 | // If we're not what we're supposed to be in the physics scene, recreate ourselves. |
1313 | //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); | 1316 | //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); |
1314 | /// that's not wholesome. Had to make Scene public | 1317 | /// that's not wholesome. Had to make Scene public |
@@ -1331,6 +1334,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1331 | 1334 | ||
1332 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | 1335 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; |
1333 | PhysActor.OnOutOfBounds += PhysicsOutOfBounds; | 1336 | PhysActor.OnOutOfBounds += PhysicsOutOfBounds; |
1337 | if (ParentID != 0 && ParentID != LocalID) | ||
1338 | { | ||
1339 | if (ParentGroup.RootPart.PhysActor != null) | ||
1340 | { | ||
1341 | PhysActor.link(ParentGroup.RootPart.PhysActor); | ||
1342 | } | ||
1343 | } | ||
1344 | |||
1334 | } | 1345 | } |
1335 | } | 1346 | } |
1336 | } | 1347 | } |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index e3b9ef3..c7ccef3 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -349,7 +349,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
349 | get { return true; } | 349 | get { return true; } |
350 | set { } | 350 | set { } |
351 | } | 351 | } |
352 | public override void link(PhysicsActor obj) | ||
353 | { | ||
354 | |||
355 | } | ||
352 | 356 | ||
357 | public override void delink() | ||
358 | { | ||
359 | |||
360 | } | ||
353 | public void SetAcceleration(PhysicsVector accel) | 361 | public void SetAcceleration(PhysicsVector accel) |
354 | { | 362 | { |
355 | _acceleration = accel; | 363 | _acceleration = accel; |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 8a4e4f4..12e2ea2 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -832,7 +832,15 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
832 | } | 832 | } |
833 | } | 833 | } |
834 | } | 834 | } |
835 | public override void link(PhysicsActor obj) | ||
836 | { | ||
837 | |||
838 | } | ||
835 | 839 | ||
840 | public override void delink() | ||
841 | { | ||
842 | |||
843 | } | ||
836 | public override float Mass | 844 | public override float Mass |
837 | { | 845 | { |
838 | get { return ActorMass; } | 846 | get { return ActorMass; } |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index aa6cf43..e31a08d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -132,6 +132,10 @@ namespace OpenSim.Region.Physics.Manager | |||
132 | 132 | ||
133 | public abstract void CrossingFailure(); | 133 | public abstract void CrossingFailure(); |
134 | 134 | ||
135 | public abstract void link(PhysicsActor obj); | ||
136 | |||
137 | public abstract void delink(); | ||
138 | |||
135 | public virtual void RequestPhysicsterseUpdate() | 139 | public virtual void RequestPhysicsterseUpdate() |
136 | { | 140 | { |
137 | // Make a temporary copy of the event to avoid possibility of | 141 | // Make a temporary copy of the event to avoid possibility of |
@@ -353,6 +357,16 @@ namespace OpenSim.Region.Physics.Manager | |||
353 | set { return; } | 357 | set { return; } |
354 | } | 358 | } |
355 | 359 | ||
360 | public override void link(PhysicsActor obj) | ||
361 | { | ||
362 | |||
363 | } | ||
364 | |||
365 | public override void delink() | ||
366 | { | ||
367 | |||
368 | } | ||
369 | |||
356 | public override void AddForce(PhysicsVector force) | 370 | public override void AddForce(PhysicsVector force) |
357 | { | 371 | { |
358 | return; | 372 | return; |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 2efca3b..f335246 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -490,7 +490,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
490 | return m_density*AVvolume; | 490 | return m_density*AVvolume; |
491 | } | 491 | } |
492 | } | 492 | } |
493 | public override void link(PhysicsActor obj) | ||
494 | { | ||
495 | |||
496 | } | ||
493 | 497 | ||
498 | public override void delink() | ||
499 | { | ||
500 | |||
501 | } | ||
494 | private void standupStraight() | 502 | private void standupStraight() |
495 | { | 503 | { |
496 | 504 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 34c5cfd..eb90cf4 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -90,6 +90,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
90 | public IntPtr prev_geom; | 90 | public IntPtr prev_geom; |
91 | public IntPtr _triMeshData; | 91 | public IntPtr _triMeshData; |
92 | 92 | ||
93 | private IntPtr _linkJointGroup = (IntPtr)0; | ||
94 | private PhysicsActor _parent = null; | ||
95 | private PhysicsActor m_taintparent = null; | ||
96 | |||
97 | |||
93 | private bool iscolliding = false; | 98 | private bool iscolliding = false; |
94 | private bool m_isphysical = false; | 99 | private bool m_isphysical = false; |
95 | private bool m_isSelected = false; | 100 | private bool m_isSelected = false; |
@@ -113,6 +118,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
113 | private PhysicsVector _target_velocity; | 118 | private PhysicsVector _target_velocity; |
114 | public d.Mass pMass; | 119 | public d.Mass pMass; |
115 | 120 | ||
121 | private IntPtr m_linkJoint = (IntPtr)0; | ||
122 | |||
116 | private int debugcounter = 0; | 123 | private int debugcounter = 0; |
117 | 124 | ||
118 | public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, | 125 | public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size, |
@@ -719,6 +726,45 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
719 | 726 | ||
720 | if (m_taintVelocity != PhysicsVector.Zero) | 727 | if (m_taintVelocity != PhysicsVector.Zero) |
721 | changevelocity(timestep); | 728 | changevelocity(timestep); |
729 | |||
730 | if (m_taintparent != _parent) | ||
731 | changelink(timestep); | ||
732 | } | ||
733 | |||
734 | private void changelink(float timestep) | ||
735 | { | ||
736 | while (ode.lockquery()) | ||
737 | { | ||
738 | } | ||
739 | ode.dlock(_parent_scene.world); | ||
740 | |||
741 | if (_parent == null && m_taintparent != null) | ||
742 | { | ||
743 | if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) | ||
744 | { | ||
745 | OdePrim obj = (OdePrim)m_taintparent; | ||
746 | if (obj.Body != (IntPtr)0 && Body != (IntPtr)0) | ||
747 | { | ||
748 | _linkJointGroup = d.JointGroupCreate(0); | ||
749 | m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); | ||
750 | d.JointAttach(m_linkJoint, obj.Body, Body); | ||
751 | d.JointSetFixed(m_linkJoint); | ||
752 | } | ||
753 | } | ||
754 | |||
755 | } | ||
756 | else if (_parent != null && m_taintparent == null) | ||
757 | { | ||
758 | if (Body != (IntPtr)0 && _linkJointGroup != (IntPtr)0) | ||
759 | d.JointGroupDestroy(_linkJointGroup); | ||
760 | |||
761 | _linkJointGroup = (IntPtr)0; | ||
762 | m_linkJoint = (IntPtr)0; | ||
763 | |||
764 | } | ||
765 | ode.dunlock(_parent_scene.world); | ||
766 | |||
767 | _parent = m_taintparent; | ||
722 | } | 768 | } |
723 | 769 | ||
724 | private void changeSelectedStatus(float timestep) | 770 | private void changeSelectedStatus(float timestep) |
@@ -970,8 +1016,25 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
970 | enableBody(); | 1016 | enableBody(); |
971 | //Prim auto disable after 20 frames, | 1017 | //Prim auto disable after 20 frames, |
972 | //if you move it, re-enable the prim manually. | 1018 | //if you move it, re-enable the prim manually. |
973 | 1019 | if (_parent != null) | |
1020 | { | ||
1021 | if (m_linkJoint != (IntPtr)0) | ||
1022 | { | ||
1023 | d.JointDestroy(m_linkJoint); | ||
1024 | m_linkJoint = (IntPtr)0; | ||
1025 | } | ||
1026 | } | ||
974 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | 1027 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); |
1028 | if (_parent != null) | ||
1029 | { | ||
1030 | OdePrim odParent = (OdePrim)_parent; | ||
1031 | if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0) | ||
1032 | { | ||
1033 | m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); | ||
1034 | d.JointAttach(m_linkJoint, Body, odParent.Body); | ||
1035 | d.JointSetFixed(m_linkJoint); | ||
1036 | } | ||
1037 | } | ||
975 | d.BodyEnable(Body); | 1038 | d.BodyEnable(Body); |
976 | 1039 | ||
977 | } | 1040 | } |
@@ -1652,154 +1715,172 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1652 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); | 1715 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); |
1653 | } | 1716 | } |
1654 | } | 1717 | } |
1718 | |||
1719 | public override void link(PhysicsActor obj) | ||
1720 | { | ||
1721 | m_taintparent = obj; | ||
1722 | } | ||
1723 | |||
1724 | public override void delink() | ||
1725 | { | ||
1726 | m_taintparent = null; | ||
1727 | } | ||
1728 | |||
1655 | public void UpdatePositionAndVelocity() | 1729 | public void UpdatePositionAndVelocity() |
1656 | { | 1730 | { |
1657 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1731 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
1658 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | 1732 | if (_parent != null) |
1659 | bool lastZeroFlag = _zeroFlag; | ||
1660 | if (Body != (IntPtr) 0) | ||
1661 | { | 1733 | { |
1662 | d.Vector3 vec = d.BodyGetPosition(Body); | ||
1663 | d.Quaternion ori = d.BodyGetQuaternion(Body); | ||
1664 | d.Vector3 vel = d.BodyGetLinearVel(Body); | ||
1665 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | ||
1666 | 1734 | ||
1667 | PhysicsVector l_position = new PhysicsVector(); | 1735 | } |
1736 | else | ||
1737 | { | ||
1738 | PhysicsVector pv = new PhysicsVector(0, 0, 0); | ||
1739 | bool lastZeroFlag = _zeroFlag; | ||
1740 | if (Body != (IntPtr)0) | ||
1741 | { | ||
1742 | d.Vector3 vec = d.BodyGetPosition(Body); | ||
1743 | d.Quaternion ori = d.BodyGetQuaternion(Body); | ||
1744 | d.Vector3 vel = d.BodyGetLinearVel(Body); | ||
1745 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | ||
1668 | 1746 | ||
1669 | 1747 | PhysicsVector l_position = new PhysicsVector(); | |
1670 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | ||
1671 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
1672 | //if (vec.Y < 0.0f) { vec.Y = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
1673 | //if (vec.X > 255.95f) { vec.X = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
1674 | //if (vec.Y > 255.95f) { vec.Y = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
1675 | 1748 | ||
1676 | m_lastposition = _position; | ||
1677 | 1749 | ||
1678 | l_position.X = vec.X; | 1750 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1679 | l_position.Y = vec.Y; | 1751 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
1680 | l_position.Z = vec.Z; | 1752 | //if (vec.Y < 0.0f) { vec.Y = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
1753 | //if (vec.X > 255.95f) { vec.X = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
1754 | //if (vec.Y > 255.95f) { vec.Y = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
1681 | 1755 | ||
1682 | if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) | 1756 | m_lastposition = _position; |
1683 | { | 1757 | |
1684 | base.RaiseOutOfBounds(_position); | 1758 | l_position.X = vec.X; |
1685 | } | 1759 | l_position.Y = vec.Y; |
1760 | l_position.Z = vec.Z; | ||
1761 | |||
1762 | if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) | ||
1763 | { | ||
1764 | base.RaiseOutOfBounds(_position); | ||
1765 | } | ||
1686 | //if (m_crossingfailures < 5) | 1766 | //if (m_crossingfailures < 5) |
1687 | //{ | 1767 | //{ |
1688 | //base.RequestPhysicsterseUpdate(); | 1768 | //base.RequestPhysicsterseUpdate(); |
1769 | //} | ||
1689 | //} | 1770 | //} |
1690 | //} | ||
1691 | |||
1692 | if (l_position.Z < 0) | ||
1693 | { | ||
1694 | // This is so prim that get lost underground don't fall forever and suck up | ||
1695 | // | ||
1696 | // Sim resources and memory. | ||
1697 | // Disables the prim's movement physics.... | ||
1698 | // It's a hack and will generate a console message if it fails. | ||
1699 | |||
1700 | |||
1701 | //IsPhysical = false; | ||
1702 | base.RaiseOutOfBounds(_position); | ||
1703 | _velocity.X = 0; | ||
1704 | _velocity.Y = 0; | ||
1705 | _velocity.Z = 0; | ||
1706 | m_rotationalVelocity.X = 0; | ||
1707 | m_rotationalVelocity.Y = 0; | ||
1708 | m_rotationalVelocity.Z = 0; | ||
1709 | base.RequestPhysicsterseUpdate(); | ||
1710 | m_throttleUpdates = false; | ||
1711 | throttleCounter = 0; | ||
1712 | _zeroFlag = true; | ||
1713 | //outofBounds = true; | ||
1714 | } | ||
1715 | |||
1716 | if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) | ||
1717 | && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) | ||
1718 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) | ||
1719 | { | ||
1720 | _zeroFlag = true; | ||
1721 | m_throttleUpdates = false; | ||
1722 | } | ||
1723 | else | ||
1724 | { | ||
1725 | //System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString()); | ||
1726 | _zeroFlag = false; | ||
1727 | } | ||
1728 | |||
1729 | 1771 | ||
1730 | if (_zeroFlag) | 1772 | if (l_position.Z < 0) |
1731 | { | ||
1732 | // Supposedly this is supposed to tell SceneObjectGroup that | ||
1733 | // no more updates need to be sent.. | ||
1734 | // but it seems broken. | ||
1735 | _velocity.X = 0.0f; | ||
1736 | _velocity.Y = 0.0f; | ||
1737 | _velocity.Z = 0.0f; | ||
1738 | //_orientation.w = 0f; | ||
1739 | //_orientation.x = 0f; | ||
1740 | //_orientation.y = 0f; | ||
1741 | //_orientation.z = 0f; | ||
1742 | m_rotationalVelocity.X = 0; | ||
1743 | m_rotationalVelocity.Y = 0; | ||
1744 | m_rotationalVelocity.Z = 0; | ||
1745 | if (!m_lastUpdateSent) | ||
1746 | { | 1773 | { |
1774 | // This is so prim that get lost underground don't fall forever and suck up | ||
1775 | // | ||
1776 | // Sim resources and memory. | ||
1777 | // Disables the prim's movement physics.... | ||
1778 | // It's a hack and will generate a console message if it fails. | ||
1779 | |||
1780 | |||
1781 | //IsPhysical = false; | ||
1782 | base.RaiseOutOfBounds(_position); | ||
1783 | _velocity.X = 0; | ||
1784 | _velocity.Y = 0; | ||
1785 | _velocity.Z = 0; | ||
1786 | m_rotationalVelocity.X = 0; | ||
1787 | m_rotationalVelocity.Y = 0; | ||
1788 | m_rotationalVelocity.Z = 0; | ||
1789 | base.RequestPhysicsterseUpdate(); | ||
1747 | m_throttleUpdates = false; | 1790 | m_throttleUpdates = false; |
1748 | throttleCounter = 0; | 1791 | throttleCounter = 0; |
1749 | m_rotationalVelocity = pv; | 1792 | _zeroFlag = true; |
1750 | base.RequestPhysicsterseUpdate(); | 1793 | //outofBounds = true; |
1751 | m_lastUpdateSent = true; | ||
1752 | } | 1794 | } |
1753 | } | ||
1754 | else | ||
1755 | { | ||
1756 | if (lastZeroFlag != _zeroFlag) | ||
1757 | base.RequestPhysicsterseUpdate(); | ||
1758 | |||
1759 | m_lastVelocity = _velocity; | ||
1760 | 1795 | ||
1761 | _position = l_position; | 1796 | if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) |
1762 | 1797 | && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) | |
1763 | _velocity.X = vel.X; | 1798 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) |
1764 | _velocity.Y = vel.Y; | ||
1765 | _velocity.Z = vel.Z; | ||
1766 | if (_velocity.IsIdentical(pv, 0.5f)) | ||
1767 | { | 1799 | { |
1768 | m_rotationalVelocity = pv; | 1800 | _zeroFlag = true; |
1801 | m_throttleUpdates = false; | ||
1769 | } | 1802 | } |
1770 | else | 1803 | else |
1771 | { | 1804 | { |
1772 | m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); | 1805 | //System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString()); |
1806 | _zeroFlag = false; | ||
1773 | } | 1807 | } |
1774 | 1808 | ||
1775 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); | 1809 | |
1776 | _orientation.w = ori.W; | 1810 | if (_zeroFlag) |
1777 | _orientation.x = ori.X; | ||
1778 | _orientation.y = ori.Y; | ||
1779 | _orientation.z = ori.Z; | ||
1780 | m_lastUpdateSent = false; | ||
1781 | if (!m_throttleUpdates || throttleCounter > 15) | ||
1782 | { | 1811 | { |
1783 | 1812 | // Supposedly this is supposed to tell SceneObjectGroup that | |
1784 | base.RequestPhysicsterseUpdate(); | 1813 | // no more updates need to be sent.. |
1814 | // but it seems broken. | ||
1815 | _velocity.X = 0.0f; | ||
1816 | _velocity.Y = 0.0f; | ||
1817 | _velocity.Z = 0.0f; | ||
1818 | //_orientation.w = 0f; | ||
1819 | //_orientation.x = 0f; | ||
1820 | //_orientation.y = 0f; | ||
1821 | //_orientation.z = 0f; | ||
1822 | m_rotationalVelocity.X = 0; | ||
1823 | m_rotationalVelocity.Y = 0; | ||
1824 | m_rotationalVelocity.Z = 0; | ||
1825 | if (!m_lastUpdateSent) | ||
1826 | { | ||
1827 | m_throttleUpdates = false; | ||
1828 | throttleCounter = 0; | ||
1829 | m_rotationalVelocity = pv; | ||
1830 | base.RequestPhysicsterseUpdate(); | ||
1831 | m_lastUpdateSent = true; | ||
1832 | } | ||
1785 | } | 1833 | } |
1786 | else | 1834 | else |
1787 | { | 1835 | { |
1788 | throttleCounter++; | 1836 | if (lastZeroFlag != _zeroFlag) |
1837 | base.RequestPhysicsterseUpdate(); | ||
1838 | |||
1839 | m_lastVelocity = _velocity; | ||
1840 | |||
1841 | _position = l_position; | ||
1842 | |||
1843 | _velocity.X = vel.X; | ||
1844 | _velocity.Y = vel.Y; | ||
1845 | _velocity.Z = vel.Z; | ||
1846 | if (_velocity.IsIdentical(pv, 0.5f)) | ||
1847 | { | ||
1848 | m_rotationalVelocity = pv; | ||
1849 | } | ||
1850 | else | ||
1851 | { | ||
1852 | m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); | ||
1853 | } | ||
1854 | |||
1855 | //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); | ||
1856 | _orientation.w = ori.W; | ||
1857 | _orientation.x = ori.X; | ||
1858 | _orientation.y = ori.Y; | ||
1859 | _orientation.z = ori.Z; | ||
1860 | m_lastUpdateSent = false; | ||
1861 | if (!m_throttleUpdates || throttleCounter > 15) | ||
1862 | { | ||
1863 | |||
1864 | base.RequestPhysicsterseUpdate(); | ||
1865 | } | ||
1866 | else | ||
1867 | { | ||
1868 | throttleCounter++; | ||
1869 | } | ||
1789 | } | 1870 | } |
1871 | m_lastposition = l_position; | ||
1872 | } | ||
1873 | else | ||
1874 | { | ||
1875 | // Not a body.. so Make sure the client isn't interpolating | ||
1876 | _velocity.X = 0; | ||
1877 | _velocity.Y = 0; | ||
1878 | _velocity.Z = 0; | ||
1879 | m_rotationalVelocity.X = 0; | ||
1880 | m_rotationalVelocity.Y = 0; | ||
1881 | m_rotationalVelocity.Z = 0; | ||
1882 | _zeroFlag = true; | ||
1790 | } | 1883 | } |
1791 | m_lastposition = l_position; | ||
1792 | } | ||
1793 | else | ||
1794 | { | ||
1795 | // Not a body.. so Make sure the client isn't interpolating | ||
1796 | _velocity.X = 0; | ||
1797 | _velocity.Y = 0; | ||
1798 | _velocity.Z = 0; | ||
1799 | m_rotationalVelocity.X = 0; | ||
1800 | m_rotationalVelocity.Y = 0; | ||
1801 | m_rotationalVelocity.Z = 0; | ||
1802 | _zeroFlag = true; | ||
1803 | } | 1884 | } |
1804 | } | 1885 | } |
1805 | 1886 | ||
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 9d70ac8..ac63a12 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -477,7 +477,15 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
477 | get { return true; } | 477 | get { return true; } |
478 | set { } | 478 | set { } |
479 | } | 479 | } |
480 | public override void link(PhysicsActor obj) | ||
481 | { | ||
482 | |||
483 | } | ||
480 | 484 | ||
485 | public override void delink() | ||
486 | { | ||
487 | |||
488 | } | ||
481 | public void SetAcceleration(PhysicsVector accel) | 489 | public void SetAcceleration(PhysicsVector accel) |
482 | { | 490 | { |
483 | _acceleration = accel; | 491 | _acceleration = accel; |
@@ -659,7 +667,15 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
659 | { | 667 | { |
660 | set { return; } | 668 | set { return; } |
661 | } | 669 | } |
670 | public override void link(PhysicsActor obj) | ||
671 | { | ||
672 | |||
673 | } | ||
662 | 674 | ||
675 | public override void delink() | ||
676 | { | ||
677 | |||
678 | } | ||
663 | public override bool Selected | 679 | public override bool Selected |
664 | { | 680 | { |
665 | set { return; } | 681 | set { return; } |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 83930c3..0c42260 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -366,6 +366,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
366 | { | 366 | { |
367 | } | 367 | } |
368 | 368 | ||
369 | public override void link(PhysicsActor obj) | ||
370 | { | ||
371 | |||
372 | } | ||
373 | |||
374 | public override void delink() | ||
375 | { | ||
376 | |||
377 | } | ||
378 | |||
369 | public override void SetMomentum(PhysicsVector momentum) | 379 | public override void SetMomentum(PhysicsVector momentum) |
370 | { | 380 | { |
371 | } | 381 | } |
@@ -582,6 +592,16 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
582 | set { } | 592 | set { } |
583 | } | 593 | } |
584 | 594 | ||
595 | public override void link(PhysicsActor obj) | ||
596 | { | ||
597 | |||
598 | } | ||
599 | |||
600 | public override void delink() | ||
601 | { | ||
602 | |||
603 | } | ||
604 | |||
585 | public override float Mass | 605 | public override float Mass |
586 | { | 606 | { |
587 | get { return 0f; } | 607 | get { return 0f; } |