diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 15 |
3 files changed, 44 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index f54b52f..7575fad 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -603,11 +603,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
603 | { | 603 | { |
604 | AddTerseUpdateToAllAvatars(); | 604 | AddTerseUpdateToAllAvatars(); |
605 | ClearUpdateSchedule(); | 605 | ClearUpdateSchedule(); |
606 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0) | 606 | |
607 | { | 607 | // This causes the Scene to 'poll' physical objects every couple of frames |
608 | // bad, so it's been replaced by an event driven method. | ||
609 | //if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0) | ||
610 | //{ | ||
608 | // Only send the constant terse updates on physical objects! | 611 | // Only send the constant terse updates on physical objects! |
609 | ScheduleTerseUpdate(); | 612 | //ScheduleTerseUpdate(); |
610 | } | 613 | //} |
611 | } | 614 | } |
612 | else | 615 | else |
613 | { | 616 | { |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index cdccc70..2e6e40f 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -819,6 +819,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
819 | internal protected virtual void ReSize(PhysicsVector _newSize) | 819 | internal protected virtual void ReSize(PhysicsVector _newSize) |
820 | { | 820 | { |
821 | } | 821 | } |
822 | public virtual void ScheduleTerseUpdate() | ||
823 | { | ||
824 | base.RequestPhysicsterseUpdate(); | ||
825 | } | ||
822 | #endregion | 826 | #endregion |
823 | } | 827 | } |
824 | 828 | ||
@@ -1003,6 +1007,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1003 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D | 1007 | //For now all prims have the same density, all prims are made of water. Be water my friend! :D |
1004 | private const float _density = 1000.0f; | 1008 | private const float _density = 1000.0f; |
1005 | private BulletXScene _parent_scene; | 1009 | private BulletXScene _parent_scene; |
1010 | private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0); | ||
1011 | private bool m_lastUpdateSent = false; | ||
1006 | 1012 | ||
1007 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, | 1013 | public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, |
1008 | AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs, bool isPhysical) | 1014 | AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs, bool isPhysical) |
@@ -1148,8 +1154,28 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
1148 | if (_physical) //Updates properties. Prim updates its properties physically | 1154 | if (_physical) //Updates properties. Prim updates its properties physically |
1149 | { | 1155 | { |
1150 | _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); | 1156 | _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); |
1157 | |||
1151 | _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); | 1158 | _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); |
1152 | _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); | 1159 | _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); |
1160 | |||
1161 | if ((Math.Abs(m_prev_position.X - _position.X) < 0.03) | ||
1162 | && (Math.Abs(m_prev_position.Y - _position.Y) < 0.03) | ||
1163 | && (Math.Abs(m_prev_position.Z - _position.Z) < 0.03)) | ||
1164 | { | ||
1165 | if (!m_lastUpdateSent) | ||
1166 | { | ||
1167 | _velocity = new PhysicsVector(0, 0, 0); | ||
1168 | base.ScheduleTerseUpdate(); | ||
1169 | m_lastUpdateSent = true; | ||
1170 | } | ||
1171 | } | ||
1172 | else | ||
1173 | { | ||
1174 | m_lastUpdateSent = false; | ||
1175 | base.ScheduleTerseUpdate(); | ||
1176 | |||
1177 | } | ||
1178 | m_prev_position = _position; | ||
1153 | } | 1179 | } |
1154 | else //Doesn't updates properties. That's a cancel | 1180 | else //Doesn't updates properties. That's a cancel |
1155 | { | 1181 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 4750e54..79f51a1 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -124,7 +124,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
124 | space = d.HashSpaceCreate(IntPtr.Zero); | 124 | space = d.HashSpaceCreate(IntPtr.Zero); |
125 | contactgroup = d.JointGroupCreate(0); | 125 | contactgroup = d.JointGroupCreate(0); |
126 | //contactgroup | 126 | //contactgroup |
127 | 127 | ||
128 | |||
128 | d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); | 129 | d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); |
129 | d.WorldSetAutoDisableFlag(world, false); | 130 | d.WorldSetAutoDisableFlag(world, false); |
130 | d.WorldSetContactSurfaceLayer(world, 0.001f); | 131 | d.WorldSetContactSurfaceLayer(world, 0.001f); |
@@ -936,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
936 | private String m_primName; | 937 | private String m_primName; |
937 | private PhysicsVector _target_velocity; | 938 | private PhysicsVector _target_velocity; |
938 | public d.Mass pMass; | 939 | public d.Mass pMass; |
939 | private const float MassMultiplier = 500f; // Ref: Water: 1000kg.. this iset to 500 | 940 | private const float MassMultiplier = 150f; // Ref: Water: 1000kg.. this iset to 500 |
940 | private int debugcounter = 0; | 941 | private int debugcounter = 0; |
941 | 942 | ||
942 | 943 | ||
@@ -1361,7 +1362,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1361 | //System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString()); | 1362 | //System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString()); |
1362 | _zeroFlag = false; | 1363 | _zeroFlag = false; |
1363 | } | 1364 | } |
1364 | m_lastposition = l_position; | 1365 | |
1365 | 1366 | ||
1366 | 1367 | ||
1367 | if (_zeroFlag) | 1368 | if (_zeroFlag) |
@@ -1379,6 +1380,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1379 | m_rotationalVelocity.X = 0; | 1380 | m_rotationalVelocity.X = 0; |
1380 | m_rotationalVelocity.Y = 0; | 1381 | m_rotationalVelocity.Y = 0; |
1381 | m_rotationalVelocity.Z = 0; | 1382 | m_rotationalVelocity.Z = 0; |
1383 | if (!m_lastUpdateSent) | ||
1384 | { | ||
1385 | base.RequestPhysicsterseUpdate(); | ||
1386 | m_lastUpdateSent = true; | ||
1387 | } | ||
1382 | 1388 | ||
1383 | } | 1389 | } |
1384 | else | 1390 | else |
@@ -1399,9 +1405,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1399 | _orientation.x = ori.X; | 1405 | _orientation.x = ori.X; |
1400 | _orientation.y = ori.Y; | 1406 | _orientation.y = ori.Y; |
1401 | _orientation.z = ori.Z; | 1407 | _orientation.z = ori.Z; |
1408 | m_lastUpdateSent = false; | ||
1402 | base.RequestPhysicsterseUpdate(); | 1409 | base.RequestPhysicsterseUpdate(); |
1403 | } | 1410 | } |
1404 | 1411 | m_lastposition = l_position; | |
1405 | } | 1412 | } |
1406 | else | 1413 | else |
1407 | { | 1414 | { |