diff options
Diffstat (limited to 'OpenSim/Region')
4 files changed, 40 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index be0e985..b43caf2 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -56,7 +56,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
56 | // protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist! | 56 | // protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist! |
57 | protected string m_movementAnimation = "CROUCH"; //KF: CROUCH ensures reliable Av Anim. init. | 57 | protected string m_movementAnimation = "CROUCH"; //KF: CROUCH ensures reliable Av Anim. init. |
58 | private int m_animTickFall; | 58 | private int m_animTickFall; |
59 | private int m_animTickJump; | 59 | // private int m_animTickJump; |
60 | public int m_animTickJump; // ScenePresence has to see this to control +Z force | ||
60 | 61 | ||
61 | /// <value> | 62 | /// <value> |
62 | /// The scene presence that this animator applies to | 63 | /// The scene presence that this animator applies to |
@@ -123,22 +124,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
123 | /// </summary> | 124 | /// </summary> |
124 | public void TrySetMovementAnimation(string anim) | 125 | public void TrySetMovementAnimation(string anim) |
125 | { | 126 | { |
126 | //Console.WriteLine("Updating movement animation to {0}", anim); | ||
127 | |||
128 | if (!m_scenePresence.IsChildAgent) | 127 | if (!m_scenePresence.IsChildAgent) |
129 | { | 128 | { |
130 | if (m_animations.TrySetDefaultAnimation( | 129 | if (m_animations.TrySetDefaultAnimation( |
131 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) | 130 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) |
132 | { | 131 | { |
133 | //Console.WriteLine("TSMA {0} success.", anim); | ||
134 | // 16384 is CHANGED_ANIMATION | 132 | // 16384 is CHANGED_ANIMATION |
135 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); | 133 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); |
136 | SendAnimPack(); | 134 | SendAnimPack(); |
137 | } | 135 | } |
138 | else | ||
139 | { | ||
140 | //Console.WriteLine("TSMA {0} fail.", anim); | ||
141 | } | ||
142 | } | 136 | } |
143 | } | 137 | } |
144 | 138 | ||
@@ -267,7 +261,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
267 | m_animTickJump = Environment.TickCount; | 261 | m_animTickJump = Environment.TickCount; |
268 | return "PREJUMP"; | 262 | return "PREJUMP"; |
269 | } | 263 | } |
270 | else if (Environment.TickCount - m_animTickJump > PREJUMP_DELAY * 1000.0f) | 264 | else if (Environment.TickCount - m_animTickJump > PREJUMP_DELAY * 800.0f) |
271 | { | 265 | { |
272 | // Start actual jump | 266 | // Start actual jump |
273 | if (m_animTickJump == -1) | 267 | if (m_animTickJump == -1) |
@@ -317,7 +311,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
317 | public void UpdateMovementAnimations() | 311 | public void UpdateMovementAnimations() |
318 | { | 312 | { |
319 | m_movementAnimation = GetMovementAnimation(); | 313 | m_movementAnimation = GetMovementAnimation(); |
320 | //Console.WriteLine("UMA got {0}", m_movementAnimation); | ||
321 | if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) | 314 | if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) |
322 | { | 315 | { |
323 | // This was the previous behavior before PREJUMP | 316 | // This was the previous behavior before PREJUMP |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0556166..ee097bc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -613,7 +613,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
613 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 613 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
614 | // TODO: Change default to true once the feature is supported | 614 | // TODO: Change default to true once the feature is supported |
615 | m_usePreJump = startupConfig.GetBoolean("enableprejump", false); | 615 | m_usePreJump = startupConfig.GetBoolean("enableprejump", false); |
616 | 616 | m_usePreJump = true; // Above line fails!? | |
617 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 617 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
618 | if (RegionInfo.NonphysPrimMax > 0) | 618 | if (RegionInfo.NonphysPrimMax > 0) |
619 | { | 619 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2603fe1..565438d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -665,7 +665,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
665 | CreateSceneViewer(); | 665 | CreateSceneViewer(); |
666 | m_animator = new ScenePresenceAnimator(this); | 666 | m_animator = new ScenePresenceAnimator(this); |
667 | } | 667 | } |
668 | 668 | ||
669 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() | 669 | private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() |
670 | { | 670 | { |
671 | m_rootRegionHandle = reginfo.RegionHandle; | 671 | m_rootRegionHandle = reginfo.RegionHandle; |
@@ -1459,7 +1459,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1459 | } | 1459 | } |
1460 | i++; | 1460 | i++; |
1461 | } | 1461 | } |
1462 | |||
1463 | //Paupaw:Do Proper PID for Autopilot here | 1462 | //Paupaw:Do Proper PID for Autopilot here |
1464 | if (bResetMoveToPosition) | 1463 | if (bResetMoveToPosition) |
1465 | { | 1464 | { |
@@ -2433,10 +2432,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2433 | Rotation = rotation; | 2432 | Rotation = rotation; |
2434 | Vector3 direc = vec * rotation; | 2433 | Vector3 direc = vec * rotation; |
2435 | direc.Normalize(); | 2434 | direc.Normalize(); |
2435 | PhysicsActor actor = m_physicsActor; | ||
2436 | if ((vec.Z == 0f) && !actor.Flying) direc.Z = 0f; // Prevent camera WASD up. | ||
2436 | 2437 | ||
2437 | direc *= 0.03f * 128f * m_speedModifier; | 2438 | direc *= 0.03f * 128f * m_speedModifier; |
2438 | 2439 | ||
2439 | PhysicsActor actor = m_physicsActor; | ||
2440 | if (actor != null) | 2440 | if (actor != null) |
2441 | { | 2441 | { |
2442 | if (actor.Flying) | 2442 | if (actor.Flying) |
@@ -2458,11 +2458,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2458 | { | 2458 | { |
2459 | if (direc.Z > 2.0f) | 2459 | if (direc.Z > 2.0f) |
2460 | { | 2460 | { |
2461 | direc.Z *= 3.0f; | 2461 | if(m_animator.m_animTickJump == -1) |
2462 | 2462 | { | |
2463 | // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. | 2463 | direc.Z *= 3.0f; // jump |
2464 | Animator.TrySetMovementAnimation("PREJUMP"); | 2464 | } |
2465 | Animator.TrySetMovementAnimation("JUMP"); | 2465 | else |
2466 | { | ||
2467 | direc.Z *= 0.1f; // prejump | ||
2468 | } | ||
2469 | /* Animations are controlled via GetMovementAnimation() in ScenePresenceAnimator.cs | ||
2470 | Animator.TrySetMovementAnimation("PREJUMP"); | ||
2471 | Animator.TrySetMovementAnimation("JUMP"); | ||
2472 | */ | ||
2466 | } | 2473 | } |
2467 | } | 2474 | } |
2468 | } | 2475 | } |
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index 7a5093b..38c38b6 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | |||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
142 | // unique UUID of this character object | 142 | // unique UUID of this character object |
143 | public UUID m_uuid; | 143 | public UUID m_uuid; |
144 | public bool bad = false; | 144 | public bool bad = false; |
145 | 145 | ||
146 | public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) | 146 | public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) |
147 | { | 147 | { |
148 | m_uuid = UUID.Random(); | 148 | m_uuid = UUID.Random(); |
@@ -892,7 +892,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
892 | 892 | ||
893 | // If the PID Controller isn't active then we set our force | 893 | // If the PID Controller isn't active then we set our force |
894 | // calculating base velocity to the current position | 894 | // calculating base velocity to the current position |
895 | 895 | ||
896 | if (Body == IntPtr.Zero) | 896 | if (Body == IntPtr.Zero) |
897 | return; | 897 | return; |
898 | 898 | ||
@@ -972,8 +972,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
972 | // Prim to avatar collisions | 972 | // Prim to avatar collisions |
973 | 973 | ||
974 | d.Vector3 pos = d.BodyGetPosition(Body); | 974 | d.Vector3 pos = d.BodyGetPosition(Body); |
975 | vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); | 975 | float errX = _zeroPosition.X - pos.X; |
976 | vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2); | 976 | float errY = _zeroPosition.Y - pos.Y; |
977 | if( (Math.Abs(errX) > 0.1f) || (Math.Abs(errY) > 0.1f) ) | ||
978 | { | ||
979 | vec.X = (_target_velocity.X - vel.X) * (PID_D) + (errX) * (PID_P * 2); | ||
980 | vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (errY) * (PID_P * 2); | ||
981 | } | ||
982 | else | ||
983 | { // close, jump to lateral destination | ||
984 | d.BodySetPosition(Body, _zeroPosition.X, _zeroPosition.Y, pos.Z); | ||
985 | } | ||
977 | if (flying) | 986 | if (flying) |
978 | { | 987 | { |
979 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; | 988 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; |
@@ -1056,11 +1065,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1056 | } | 1065 | } |
1057 | if (vec.IsFinite()) | 1066 | if (vec.IsFinite()) |
1058 | { | 1067 | { |
1059 | doForce(vec); | 1068 | if (!vec.ApproxEquals(Vector3.Zero, 0.01f)) |
1060 | if (!_zeroFlag) | 1069 | { |
1061 | { | 1070 | doForce(vec); |
1062 | AlignAvatarTiltWithCurrentDirectionOfMovement(vec); | 1071 | if (!_zeroFlag) |
1063 | } | 1072 | { |
1073 | AlignAvatarTiltWithCurrentDirectionOfMovement(vec); | ||
1074 | } | ||
1075 | } | ||
1064 | } | 1076 | } |
1065 | else | 1077 | else |
1066 | { | 1078 | { |