aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-13 21:42:24 +0100
committerJustin Clark-Casey (justincc)2011-10-13 21:42:24 +0100
commit20da04fd0c909a00c0cdc2585f242e95c868801a (patch)
tree218710c15d1a240bd1c2cca8197c5a696bea0b44
parentrefactor: move 3x copy/pasted ode structure removal code in ODECharacter into... (diff)
downloadopensim-SC_OLD-20da04fd0c909a00c0cdc2585f242e95c868801a.zip
opensim-SC_OLD-20da04fd0c909a00c0cdc2585f242e95c868801a.tar.gz
opensim-SC_OLD-20da04fd0c909a00c0cdc2585f242e95c868801a.tar.bz2
opensim-SC_OLD-20da04fd0c909a00c0cdc2585f242e95c868801a.tar.xz
More method doc and formatting changes. Makes DestroyOdeStructures() private
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs25
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs16
3 files changed, 39 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index a4887ad..024ebce 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4744,6 +4744,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4744 position = presence.OffsetPosition; 4744 position = presence.OffsetPosition;
4745 velocity = presence.Velocity; 4745 velocity = presence.Velocity;
4746 acceleration = Vector3.Zero; 4746 acceleration = Vector3.Zero;
4747
4748 // Interestingly, sending this to non-zero will cause the client's avatar to start moving & accelerating
4749 // in that direction, even though we don't model this on the server. Implementing this in the future
4750 // may improve movement smoothness.
4751// acceleration = new Vector3(1, 0, 0);
4752
4747 angularVelocity = Vector3.Zero; 4753 angularVelocity = Vector3.Zero;
4748 rotation = presence.Rotation; 4754 rotation = presence.Rotation;
4749 4755
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 1c36e55..96dcfb6 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -202,10 +202,18 @@ namespace OpenSim.Region.Physics.Manager
202 202
203 public virtual void SetMaterial (int material) 203 public virtual void SetMaterial (int material)
204 { 204 {
205
206 } 205 }
207 206
207 /// <summary>
208 /// Position of this actor.
209 /// </summary>
210 /// <remarks>
211 /// Setting this directly moves the actor to a given position.
212 /// Getting this retrieves the position calculated by physics scene updates, using factors such as velocity and
213 /// collisions.
214 /// </remarks>
208 public abstract Vector3 Position { get; set; } 215 public abstract Vector3 Position { get; set; }
216
209 public abstract float Mass { get; } 217 public abstract float Mass { get; }
210 public abstract Vector3 Force { get; set; } 218 public abstract Vector3 Force { get; set; }
211 219
@@ -215,11 +223,24 @@ namespace OpenSim.Region.Physics.Manager
215 public abstract void VehicleRotationParam(int param, Quaternion rotation); 223 public abstract void VehicleRotationParam(int param, Quaternion rotation);
216 public abstract void VehicleFlags(int param, bool remove); 224 public abstract void VehicleFlags(int param, bool remove);
217 225
218 public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more 226 /// <summary>
227 /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
228 /// </summary>
229 public abstract void SetVolumeDetect(int param);
219 230
220 public abstract Vector3 GeometricCenter { get; } 231 public abstract Vector3 GeometricCenter { get; }
221 public abstract Vector3 CenterOfMass { get; } 232 public abstract Vector3 CenterOfMass { get; }
233
234 /// <summary>
235 /// Velocity of this actor.
236 /// </summary>
237 /// <remarks>
238 /// Setting this provides a target velocity for physics scene updates.
239 /// Getting this returns the velocity calculated by physics scene updates, using factors such as target velocity,
240 /// time to accelerate and collisions.
241 /// </remarks>
222 public abstract Vector3 Velocity { get; set; } 242 public abstract Vector3 Velocity { get; set; }
243
223 public abstract Vector3 Torque { get; set; } 244 public abstract Vector3 Torque { get; set; }
224 public abstract float CollisionScore { get; set;} 245 public abstract float CollisionScore { get; set;}
225 public abstract Vector3 Acceleration { get; } 246 public abstract Vector3 Acceleration { get; }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 92927e4..7f3ae6b 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -886,7 +886,6 @@ namespace OpenSim.Region.Physics.OdePlugin
886 d.BodyAddForce(Body, force.X, force.Y, force.Z); 886 d.BodyAddForce(Body, force.X, force.Y, force.Z);
887 //d.BodySetRotation(Body, ref m_StandUpRotation); 887 //d.BodySetRotation(Body, ref m_StandUpRotation);
888 //standupStraight(); 888 //standupStraight();
889
890 } 889 }
891 } 890 }
892 891
@@ -901,7 +900,8 @@ namespace OpenSim.Region.Physics.OdePlugin
901 /// <param name="timeStep"></param> 900 /// <param name="timeStep"></param>
902 /// <param name="defects"> 901 /// <param name="defects">
903 /// If there is something wrong with the character (e.g. its position is non-finite) 902 /// If there is something wrong with the character (e.g. its position is non-finite)
904 /// then it is added to this list. The ODE structures associated with it are also destroyed.</param> 903 /// then it is added to this list. The ODE structures associated with it are also destroyed.
904 /// </param>
905 public void Move(float timeStep, List<OdeCharacter> defects) 905 public void Move(float timeStep, List<OdeCharacter> defects)
906 { 906 {
907 // no lock; for now it's only called from within Simulate() 907 // no lock; for now it's only called from within Simulate()
@@ -966,7 +966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
966 966
967 d.Vector3 pos = d.BodyGetPosition(Body); 967 d.Vector3 pos = d.BodyGetPosition(Body);
968 vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); 968 vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2);
969 vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2); 969 vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2);
970 if (flying) 970 if (flying)
971 { 971 {
972 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; 972 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
@@ -995,6 +995,10 @@ namespace OpenSim.Region.Physics.OdePlugin
995 // we're in mid air suspended 995 // we're in mid air suspended
996 vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D / 6); 996 vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D / 6);
997 vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D / 6); 997 vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D / 6);
998
999// m_log.DebugFormat(
1000// "[ODE CHARACTER]: !m_iscolliding && flying, vec {0}, _target_velocity {1}, movementdivisor {2}, vel {3}",
1001// vec, _target_velocity, movementdivisor, vel);
998 } 1002 }
999 1003
1000 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) 1004 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
@@ -1020,11 +1024,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1020 // d.Vector3 pos = d.BodyGetPosition(Body); 1024 // d.Vector3 pos = d.BodyGetPosition(Body);
1021 if (_target_velocity.X > 0) 1025 if (_target_velocity.X > 0)
1022 { 1026 {
1023 vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D; 1027 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
1024 } 1028 }
1025 if (_target_velocity.Y > 0) 1029 if (_target_velocity.Y > 0)
1026 { 1030 {
1027 vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D; 1031 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
1028 } 1032 }
1029 } 1033 }
1030 1034
@@ -1167,7 +1171,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1167 /// <summary> 1171 /// <summary>
1168 /// Used internally to destroy the ODE structures associated with this character. 1172 /// Used internally to destroy the ODE structures associated with this character.
1169 /// </summary> 1173 /// </summary>
1170 public void DestroyOdeStructures() 1174 private void DestroyOdeStructures()
1171 { 1175 {
1172 // destroy avatar capsule and related ODE data 1176 // destroy avatar capsule and related ODE data
1173 if (Amotor != IntPtr.Zero) 1177 if (Amotor != IntPtr.Zero)