diff options
author | Teravus Ovares | 2007-11-09 13:45:42 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-09 13:45:42 +0000 |
commit | 90274434c62ecf7184b609940db4b7059ffdc4e2 (patch) | |
tree | 26bb7ec06f6445bfbf589c4388f163a64bd00d6b /OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |
parent | * Protip: Commit AFTER compiling. (diff) | |
download | opensim-SC-90274434c62ecf7184b609940db4b7059ffdc4e2.zip opensim-SC-90274434c62ecf7184b609940db4b7059ffdc4e2.tar.gz opensim-SC-90274434c62ecf7184b609940db4b7059ffdc4e2.tar.bz2 opensim-SC-90274434c62ecf7184b609940db4b7059ffdc4e2.tar.xz |
* Moved BulletX off of the 'constant terse update' method. It now only sends terse updates when needed.
* Removed the 'constant poll method' from SceneObjectPart.cs - It was bad :P
* Updated some Masses in ODE to help large prim slow down by friction easier.
Diffstat (limited to 'OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 26 |
1 files changed, 26 insertions, 0 deletions
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 | { |