diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 |
2 files changed, 33 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 30a95ce..2d41342 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -53,8 +53,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
53 | { | 53 | { |
54 | get { return m_movementAnimation; } | 54 | get { return m_movementAnimation; } |
55 | } | 55 | } |
56 | protected string m_movementAnimation = "DEFAULT"; | 56 | // protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist! |
57 | 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 | 60 | ||
@@ -123,17 +123,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
123 | /// </summary> | 123 | /// </summary> |
124 | public void TrySetMovementAnimation(string anim) | 124 | public void TrySetMovementAnimation(string anim) |
125 | { | 125 | { |
126 | //m_log.DebugFormat("Updating movement animation to {0}", anim); | 126 | //Console.WriteLine("Updating movement animation to {0}", anim); |
127 | 127 | ||
128 | if (!m_scenePresence.IsChildAgent) | 128 | if (!m_scenePresence.IsChildAgent) |
129 | { | 129 | { |
130 | if (m_animations.TrySetDefaultAnimation( | 130 | if (m_animations.TrySetDefaultAnimation( |
131 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) | 131 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) |
132 | { | 132 | { |
133 | //Console.WriteLine("TSMA {0} success.", anim); | ||
133 | // 16384 is CHANGED_ANIMATION | 134 | // 16384 is CHANGED_ANIMATION |
134 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); | 135 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); |
135 | SendAnimPack(); | 136 | SendAnimPack(); |
136 | } | 137 | } |
138 | else | ||
139 | { | ||
140 | //Console.WriteLine("TSMA {0} fail.", anim); | ||
141 | } | ||
137 | } | 142 | } |
138 | } | 143 | } |
139 | 144 | ||
@@ -313,7 +318,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
313 | public void UpdateMovementAnimations() | 318 | public void UpdateMovementAnimations() |
314 | { | 319 | { |
315 | m_movementAnimation = GetMovementAnimation(); | 320 | m_movementAnimation = GetMovementAnimation(); |
316 | 321 | //Console.WriteLine("UMA got {0}", m_movementAnimation); | |
317 | if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) | 322 | if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) |
318 | { | 323 | { |
319 | // This was the previous behavior before PREJUMP | 324 | // This was the previous behavior before PREJUMP |
@@ -445,4 +450,4 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
445 | SendAnimPack(animIDs, sequenceNums, objectIDs); | 450 | SendAnimPack(animIDs, sequenceNums, objectIDs); |
446 | } | 451 | } |
447 | } | 452 | } |
448 | } \ No newline at end of file | 453 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4e5fee1..a65b84b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | /// issue #1716 | 90 | /// issue #1716 |
91 | /// </summary> | 91 | /// </summary> |
92 | // private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); | 92 | // private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); |
93 | // Value revised by KF 091121 by comparison with SL. | ||
93 | private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); | 94 | private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); |
94 | 95 | ||
95 | public UUID currentParcelUUID = UUID.Zero; | 96 | public UUID currentParcelUUID = UUID.Zero; |
@@ -205,6 +206,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
205 | private bool m_followCamAuto; | 206 | private bool m_followCamAuto; |
206 | 207 | ||
207 | private int m_movementUpdateCount; | 208 | private int m_movementUpdateCount; |
209 | private int m_lastColCount = -1; //KF: Look for Collision chnages | ||
210 | private int m_updateCount = 0; //KF: Update Anims for a while | ||
211 | private static readonly int UPDATE_COUNT = 10; // how many frames to update for | ||
208 | 212 | ||
209 | private const int NumMovementsBetweenRayCast = 5; | 213 | private const int NumMovementsBetweenRayCast = 5; |
210 | 214 | ||
@@ -662,9 +666,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
662 | 666 | ||
663 | AdjustKnownSeeds(); | 667 | AdjustKnownSeeds(); |
664 | 668 | ||
665 | // TODO: I think, this won't send anything, as we are still a child here... | 669 | Animator.TrySetMovementAnimation("STAND"); |
666 | Animator.TrySetMovementAnimation("STAND"); | ||
667 | |||
668 | // we created a new ScenePresence (a new child agent) in a fresh region. | 670 | // we created a new ScenePresence (a new child agent) in a fresh region. |
669 | // Request info about all the (root) agents in this region | 671 | // Request info about all the (root) agents in this region |
670 | // Note: This won't send data *to* other clients in that region (children don't send) | 672 | // Note: This won't send data *to* other clients in that region (children don't send) |
@@ -1018,7 +1020,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1018 | { | 1020 | { |
1019 | AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); | 1021 | AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); |
1020 | } | 1022 | } |
1021 | 1023 | ||
1024 | m_updateCount = UPDATE_COUNT; //KF: Trigger Anim updates to catch falling anim. | ||
1025 | |||
1022 | ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, | 1026 | ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, |
1023 | AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); | 1027 | AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); |
1024 | } | 1028 | } |
@@ -1266,9 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1266 | 1270 | ||
1267 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) | 1271 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) |
1268 | { | 1272 | { |
1269 | // TODO: This doesn't prevent the user from walking yet. | 1273 | m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. |
1270 | // Setting parent ID would fix this, if we knew what value | ||
1271 | // to use. Or we could add a m_isSitting variable. | ||
1272 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 1274 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
1273 | } | 1275 | } |
1274 | 1276 | ||
@@ -1926,7 +1928,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1926 | 1928 | ||
1927 | public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance) | 1929 | public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance) |
1928 | { | 1930 | { |
1929 | // Console.WriteLine("[RAYCASTRESULT]: Hit={0}, Point={1}, ID={2}, Dist={3}", hitYN, collisionPoint, localid, distance); | ||
1930 | if(hitYN) | 1931 | if(hitYN) |
1931 | { | 1932 | { |
1932 | // m_pos = Av offset from prim center to make look like on center | 1933 | // m_pos = Av offset from prim center to make look like on center |
@@ -2964,6 +2965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2964 | m_updateflag = true; | 2965 | m_updateflag = true; |
2965 | Velocity = force; | 2966 | Velocity = force; |
2966 | m_isNudging = false; | 2967 | m_isNudging = false; |
2968 | m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND" | ||
2967 | } | 2969 | } |
2968 | } | 2970 | } |
2969 | } | 2971 | } |
@@ -3015,19 +3017,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3015 | // Event called by the physics plugin to tell the avatar about a collision. | 3017 | // Event called by the physics plugin to tell the avatar about a collision. |
3016 | private void PhysicsCollisionUpdate(EventArgs e) | 3018 | private void PhysicsCollisionUpdate(EventArgs e) |
3017 | { | 3019 | { |
3020 | if (m_updateCount > 0) //KF: Update Anims for a short period. Many Anim | ||
3021 | { // changes are very asynchronous. | ||
3022 | Animator.UpdateMovementAnimations(); | ||
3023 | m_updateCount--; | ||
3024 | } | ||
3025 | |||
3018 | if (e == null) | 3026 | if (e == null) |
3019 | return; | 3027 | return; |
3020 | 3028 | ||
3021 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | ||
3022 | // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( | 3029 | // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( |
3023 | // as of this comment the interval is set in AddToPhysicalScene | 3030 | // as of this comment the interval is set in AddToPhysicalScene |
3024 | Animator.UpdateMovementAnimations(); | 3031 | |
3025 | |||
3026 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3032 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
3027 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; | 3033 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; |
3028 | 3034 | ||
3029 | CollisionPlane = Vector4.UnitW; | 3035 | CollisionPlane = Vector4.UnitW; |
3030 | 3036 | ||
3037 | if (m_lastColCount != coldata.Count) | ||
3038 | { | ||
3039 | m_updateCount = 10; | ||
3040 | m_lastColCount = coldata.Count; | ||
3041 | } | ||
3042 | |||
3031 | if (coldata.Count != 0) | 3043 | if (coldata.Count != 0) |
3032 | { | 3044 | { |
3033 | switch (Animator.CurrentMovementAnimation) | 3045 | switch (Animator.CurrentMovementAnimation) |