diff options
author | UbitUmarov | 2015-08-20 13:45:45 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-20 13:45:45 +0100 |
commit | 43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1 (patch) | |
tree | 496b8d69d6837e81dcaa52dfab182f9de11442bc /OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |
parent | put back entities remove from updates on SendKillObject. (diff) | |
download | opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.zip opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.tar.gz opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.tar.bz2 opensim-SC-43a83da5ce4e26d21efe0fb06ba5e6d7a49e39c1.tar.xz |
update old git to os core version
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 86735de..05eaf2a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -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,8 +504,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
500 | { | 504 | { |
501 | m_pidControllerActive = true; | 505 | m_pidControllerActive = true; |
502 | 506 | ||
503 | m_tainted_CAPSULE_LENGTH = (size.Z) - 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 | { |
@@ -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; } } |