aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2010-05-08 14:17:43 +0100
committerMelanie2010-05-08 14:17:43 +0100
commit420dd78fb7f48c4d6645773992cc2da968529b15 (patch)
tree49ee8760c5c9ce6d28c3002fb6bf251e707546bf /OpenSim/Region
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff)
downloadopensim-SC_OLD-420dd78fb7f48c4d6645773992cc2da968529b15.zip
opensim-SC_OLD-420dd78fb7f48c4d6645773992cc2da968529b15.tar.gz
opensim-SC_OLD-420dd78fb7f48c4d6645773992cc2da968529b15.tar.bz2
opensim-SC_OLD-420dd78fb7f48c4d6645773992cc2da968529b15.tar.xz
Merge branch 'careminster' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs23
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs30
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 31ca2ab..702a1e2 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 2197ced..122ed02 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -727,7 +727,7 @@ namespace OpenSim.Region.Framework.Scenes
727 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 727 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
728 // TODO: Change default to true once the feature is supported 728 // TODO: Change default to true once the feature is supported
729 m_usePreJump = startupConfig.GetBoolean("enableprejump", false); 729 m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
730 730 m_usePreJump = true; // Above line fails!?
731 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 731 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
732 if (RegionInfo.NonphysPrimMax > 0) 732 if (RegionInfo.NonphysPrimMax > 0)
733 { 733 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cb24784..d76f029 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -678,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes
678 CreateSceneViewer(); 678 CreateSceneViewer();
679 m_animator = new ScenePresenceAnimator(this); 679 m_animator = new ScenePresenceAnimator(this);
680 } 680 }
681 681
682 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() 682 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
683 { 683 {
684 m_rootRegionHandle = reginfo.RegionHandle; 684 m_rootRegionHandle = reginfo.RegionHandle;
@@ -1468,7 +1468,6 @@ namespace OpenSim.Region.Framework.Scenes
1468 } 1468 }
1469 i++; 1469 i++;
1470 } 1470 }
1471
1472 //Paupaw:Do Proper PID for Autopilot here 1471 //Paupaw:Do Proper PID for Autopilot here
1473 if (bResetMoveToPosition) 1472 if (bResetMoveToPosition)
1474 { 1473 {
@@ -2447,10 +2446,11 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2447 Rotation = rotation; 2446 Rotation = rotation;
2448 Vector3 direc = vec * rotation; 2447 Vector3 direc = vec * rotation;
2449 direc.Normalize(); 2448 direc.Normalize();
2449 PhysicsActor actor = m_physicsActor;
2450 if ((vec.Z == 0f) && !actor.Flying) direc.Z = 0f; // Prevent camera WASD up.
2450 2451
2451 direc *= 0.03f * 128f * m_speedModifier; 2452 direc *= 0.03f * 128f * m_speedModifier;
2452 2453
2453 PhysicsActor actor = m_physicsActor;
2454 if (actor != null) 2454 if (actor != null)
2455 { 2455 {
2456 if (actor.Flying) 2456 if (actor.Flying)
@@ -2472,11 +2472,18 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2472 { 2472 {
2473 if (direc.Z > 2.0f) 2473 if (direc.Z > 2.0f)
2474 { 2474 {
2475 direc.Z *= 3.0f; 2475 if(m_animator.m_animTickJump == -1)
2476 2476 {
2477 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. 2477 direc.Z *= 3.0f; // jump
2478 Animator.TrySetMovementAnimation("PREJUMP"); 2478 }
2479 Animator.TrySetMovementAnimation("JUMP"); 2479 else
2480 {
2481 direc.Z *= 0.1f; // prejump
2482 }
2483 /* Animations are controlled via GetMovementAnimation() in ScenePresenceAnimator.cs
2484 Animator.TrySetMovementAnimation("PREJUMP");
2485 Animator.TrySetMovementAnimation("JUMP");
2486 */
2480 } 2487 }
2481 } 2488 }
2482 } 2489 }
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 {