aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODECharacter.cs)64
1 files changed, 31 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
index 319f6ab..b35c299 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
@@ -31,10 +31,10 @@ using System.Reflection;
31using OpenMetaverse; 31using OpenMetaverse;
32using Ode.NET; 32using Ode.NET;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using log4net; 35using log4net;
36 36
37namespace OpenSim.Region.Physics.OdePlugin 37namespace OpenSim.Region.PhysicsModule.ODE
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 40 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
@@ -167,6 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin
167 /// <param name="avName"></param> 167 /// <param name="avName"></param>
168 /// <param name="parent_scene"></param> 168 /// <param name="parent_scene"></param>
169 /// <param name="pos"></param> 169 /// <param name="pos"></param>
170 /// <param name="vel"></param>
170 /// <param name="size"></param> 171 /// <param name="size"></param>
171 /// <param name="pid_d"></param> 172 /// <param name="pid_d"></param>
172 /// <param name="pid_p"></param> 173 /// <param name="pid_p"></param>
@@ -178,7 +179,7 @@ namespace OpenSim.Region.Physics.OdePlugin
178 /// <param name="walk_divisor"></param> 179 /// <param name="walk_divisor"></param>
179 /// <param name="rundivisor"></param> 180 /// <param name="rundivisor"></param>
180 public OdeCharacter( 181 public OdeCharacter(
181 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, 182 String avName, OdeScene parent_scene, Vector3 pos, Vector3 vel, Vector3 size, float pid_d, float pid_p,
182 float capsule_radius, float tensor, float density, 183 float capsule_radius, float tensor, float density,
183 float walk_divisor, float rundivisor) 184 float walk_divisor, float rundivisor)
184 { 185 {
@@ -210,6 +211,9 @@ namespace OpenSim.Region.Physics.OdePlugin
210 m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName); 211 m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName);
211 } 212 }
212 213
214 _velocity = vel;
215 m_taintTargetVelocity = vel;
216
213 _parent_scene = parent_scene; 217 _parent_scene = parent_scene;
214 218
215 PID_D = pid_d; 219 PID_D = pid_d;
@@ -500,12 +504,14 @@ namespace OpenSim.Region.Physics.OdePlugin
500 { 504 {
501 m_pidControllerActive = true; 505 m_pidControllerActive = true;
502 506
503 m_tainted_CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; 507 m_tainted_CAPSULE_LENGTH = size.Z - CAPSULE_RADIUS * 2.0f;
504// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH); 508
509 // m_log.InfoFormat("[ODE CHARACTER]: Size = {0}, Capsule Length = {1} (Capsule Radius = {2})",
510 // size, m_tainted_CAPSULE_LENGTH, CAPSULE_RADIUS);
505 } 511 }
506 else 512 else
507 { 513 {
508 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name); 514 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.PhysicsSceneName);
509 } 515 }
510 } 516 }
511 517
@@ -890,42 +896,30 @@ namespace OpenSim.Region.Physics.OdePlugin
890// vec, _target_velocity, movementdivisor, vel); 896// vec, _target_velocity, movementdivisor, vel);
891 } 897 }
892 898
893 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) 899 if (flying)
894 { 900 {
895 // We're colliding with something and we're not flying but we're moving 901 // This also acts as anti-gravity so that we hover when flying rather than fall.
896 // This means we're walking or running. 902 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
897 d.Vector3 pos = d.BodyGetPosition(Body);
898 vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P;
899 if (_target_velocity.X > 0)
900 {
901 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
902 }
903 if (_target_velocity.Y > 0)
904 {
905 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
906 }
907 } 903 }
908 else if (!m_iscolliding && !flying) 904 else
909 { 905 {
910 // we're not colliding and we're not flying so that means we're falling! 906 if (m_iscolliding && _target_velocity.Z > 0.0f)
911 // m_iscolliding includes collisions with the ground.
912
913 // d.Vector3 pos = d.BodyGetPosition(Body);
914 if (_target_velocity.X > 0)
915 { 907 {
908 // We're colliding with something and we're not flying but we're moving
909 // This means we're walking or running.
910 d.Vector3 pos = d.BodyGetPosition(Body);
911 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
916 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; 912 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
913 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
917 } 914 }
918 if (_target_velocity.Y > 0) 915 else if (!m_iscolliding)
919 { 916 {
917 // we're not colliding and we're not flying so that means we're falling!
918 // m_iscolliding includes collisions with the ground.
919 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
920 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; 920 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
921 } 921 }
922 } 922 }
923
924 if (flying)
925 {
926 // This also acts as anti-gravity so that we hover when flying rather than fall.
927 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
928 }
929 } 923 }
930 924
931 if (flying) 925 if (flying)
@@ -1255,7 +1249,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1255 } 1249 }
1256 1250
1257 public override Vector3 PIDTarget { set { return; } } 1251 public override Vector3 PIDTarget { set { return; } }
1258 public override bool PIDActive { set { return; } } 1252 public override bool PIDActive
1253 {
1254 get { return false; }
1255 set { return; }
1256 }
1259 public override float PIDTau { set { return; } } 1257 public override float PIDTau { set { return; } }
1260 1258
1261 public override float PIDHoverHeight { set { return; } } 1259 public override float PIDHoverHeight { set { return; } }