diff options
author | UbitUmarov | 2014-10-01 16:36:06 +0100 |
---|---|---|
committer | UbitUmarov | 2014-10-01 16:36:06 +0100 |
commit | 6d1f1103f3f2cfd6e123e8b7c42ff7561109bc50 (patch) | |
tree | 06da6db9a1fa0a211c872048e2aa5579b9af91f9 /OpenSim/Region/Framework/Scenes/Animation | |
parent | removed useless unreal inworld movement vector estimation. Do animation stat... (diff) | |
download | opensim-SC-6d1f1103f3f2cfd6e123e8b7c42ff7561109bc50.zip opensim-SC-6d1f1103f3f2cfd6e123e8b7c42ff7561109bc50.tar.gz opensim-SC-6d1f1103f3f2cfd6e123e8b7c42ff7561109bc50.tar.bz2 opensim-SC-6d1f1103f3f2cfd6e123e8b7c42ff7561109bc50.tar.xz |
clean up coments, use a even faster XY move request detection
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 84 |
1 files changed, 19 insertions, 65 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 56b8b30..2d1b0df 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -201,9 +201,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
201 | bool ret = false; | 201 | bool ret = false; |
202 | if (!m_scenePresence.IsChildAgent) | 202 | if (!m_scenePresence.IsChildAgent) |
203 | { | 203 | { |
204 | // m_log.DebugFormat( | 204 | // m_log.DebugFormat( |
205 | // "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}", | 205 | // "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}", |
206 | // anim, m_scenePresence.Name); | 206 | // anim, m_scenePresence.Name); |
207 | 207 | ||
208 | if (aoSitGndAnim != UUID.Zero) | 208 | if (aoSitGndAnim != UUID.Zero) |
209 | { | 209 | { |
@@ -240,9 +240,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
240 | if (m_animations.TrySetDefaultAnimation( | 240 | if (m_animations.TrySetDefaultAnimation( |
241 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) | 241 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) |
242 | { | 242 | { |
243 | // m_log.DebugFormat( | 243 | // m_log.DebugFormat( |
244 | // "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", | 244 | // "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", |
245 | // anim, m_scenePresence.Name); | 245 | // anim, m_scenePresence.Name); |
246 | 246 | ||
247 | // 16384 is CHANGED_ANIMATION | 247 | // 16384 is CHANGED_ANIMATION |
248 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION }); | 248 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION }); |
@@ -299,26 +299,20 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
299 | AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags; | 299 | AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags; |
300 | PhysicsActor actor = m_scenePresence.PhysicsActor; | 300 | PhysicsActor actor = m_scenePresence.PhysicsActor; |
301 | 301 | ||
302 | 302 | const AgentManager.ControlFlags ANYXYMASK = ( | |
303 | // there is no point on having this meaningless movement values, much less in world coordenates | 303 | AgentManager.ControlFlags.AGENT_CONTROL_AT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS | |
304 | // situation may change if vertical Axis of avatar is allowed to rotate. | 304 | AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG | |
305 | // then jumping etc will need some care | 305 | AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS | |
306 | 306 | AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG | |
307 | // Create forward and left vectors from the current avatar rotation | 307 | ); |
308 | /* yes matrix are better, but getting it from the Quaternion will kill the advantage | ||
309 | Matrix4 rotMatrix = Matrix4.CreateFromQuaternion(m_scenePresence.Rotation); | ||
310 | Vector3 fwd = Vector3.Transform(Vector3.UnitX, rotMatrix); | ||
311 | Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix); | ||
312 | */ | ||
313 | // there is still a better way | ||
314 | // Vector3 fwd = Vector3.UnitX * m_scenePresence.Rotation; | ||
315 | // Vector3 left = Vector3.UnitY * m_scenePresence.Rotation; | ||
316 | 308 | ||
317 | // Check control flags | 309 | // Check control flags |
310 | /* not in use | ||
318 | bool heldForward = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_AT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS)) != 0); | 311 | bool heldForward = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_AT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS)) != 0); |
319 | bool heldBack = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG)) != 0); | 312 | bool heldBack = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG)) != 0); |
320 | bool heldLeft = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS)) != 0); | 313 | bool heldLeft = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS)) != 0); |
321 | bool heldRight = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG)) != 0); | 314 | bool heldRight = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG)) != 0); |
315 | */ | ||
322 | bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; | 316 | bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; |
323 | bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; | 317 | bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; |
324 | // bool heldUp = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_UP_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS)) != 0); | 318 | // bool heldUp = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_UP_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS)) != 0); |
@@ -328,27 +322,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
328 | //bool flying = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) == AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 322 | //bool flying = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) == AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
329 | //bool mouselook = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) == AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK; | 323 | //bool mouselook = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) == AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK; |
330 | 324 | ||
331 | bool heldOnXY = (heldForward || heldBack || heldLeft || heldRight); | 325 | bool heldOnXY = ((controlFlags & ANYXYMASK) != 0); |
332 | if (heldOnXY || heldUp || heldDown) | 326 | if (heldOnXY || heldUp || heldDown) |
333 | { | 327 | { |
334 | heldTurnLeft = false; | 328 | heldTurnLeft = false; |
335 | heldTurnRight = false; | 329 | heldTurnRight = false; |
336 | } | 330 | } |
337 | 331 | ||
338 | // Direction in which the avatar is trying to move | ||
339 | /* | ||
340 | Vector3 move = Vector3.Zero; | ||
341 | if (heldForward) { move.X += fwd.X; move.Y += fwd.Y; } | ||
342 | if (heldBack) { move.X -= fwd.X; move.Y -= fwd.Y; } | ||
343 | if (heldLeft) { move.X += left.X; move.Y += left.Y; } | ||
344 | if (heldRight) { move.X -= left.X; move.Y -= left.Y; } | ||
345 | if (heldUp) { move.Z += 1; } | ||
346 | if (heldDown) { move.Z -= 1; } | ||
347 | */ | ||
348 | |||
349 | |||
350 | // Is the avatar trying to move? | ||
351 | // bool moving = (move != Vector3.Zero); | ||
352 | #endregion Inputs | 332 | #endregion Inputs |
353 | 333 | ||
354 | // no physics actor case | 334 | // no physics actor case |
@@ -357,7 +337,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
357 | // well what to do? | 337 | // well what to do? |
358 | 338 | ||
359 | currentControlState = motionControlStates.onsurface; | 339 | currentControlState = motionControlStates.onsurface; |
360 | // if (move.X != 0f || move.Y != 0f) | ||
361 | if (heldOnXY) | 340 | if (heldOnXY) |
362 | return "WALK"; | 341 | return "WALK"; |
363 | 342 | ||
@@ -377,18 +356,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
377 | 356 | ||
378 | currentControlState = motionControlStates.flying; | 357 | currentControlState = motionControlStates.flying; |
379 | 358 | ||
380 | // if (move.X != 0f || move.Y != 0f) | ||
381 | if (heldOnXY) | 359 | if (heldOnXY) |
382 | { | 360 | { |
383 | return (m_scenePresence.Scene.m_useFlySlow ? "FLYSLOW" : "FLY"); | 361 | return (m_scenePresence.Scene.m_useFlySlow ? "FLYSLOW" : "FLY"); |
384 | } | 362 | } |
385 | // else if (move.Z > 0f) | ||
386 | else if (heldUp) | 363 | else if (heldUp) |
387 | |||
388 | { | 364 | { |
389 | return "HOVER_UP"; | 365 | return "HOVER_UP"; |
390 | } | 366 | } |
391 | // else if (move.Z < 0f) | ||
392 | else if (heldDown) | 367 | else if (heldDown) |
393 | { | 368 | { |
394 | if (isColliding) | 369 | if (isColliding) |
@@ -444,7 +419,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
444 | } | 419 | } |
445 | 420 | ||
446 | // Check if the user has stopped walking just now | 421 | // Check if the user has stopped walking just now |
447 | // if (CurrentMovementAnimation == "WALK" && move == Vector3.Zero)) | ||
448 | if (CurrentMovementAnimation == "WALK" && !heldOnXY && !heldDown && !heldUp) | 422 | if (CurrentMovementAnimation == "WALK" && !heldOnXY && !heldDown && !heldUp) |
449 | return "STAND"; | 423 | return "STAND"; |
450 | 424 | ||
@@ -457,7 +431,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
457 | 431 | ||
458 | #region Jumping // section added for jumping... | 432 | #region Jumping // section added for jumping... |
459 | 433 | ||
460 | // if (isColliding && move.Z > 0f && currentControlState != motionControlStates.jumping) | ||
461 | if (isColliding && heldUp && currentControlState != motionControlStates.jumping) | 434 | if (isColliding && heldUp && currentControlState != motionControlStates.jumping) |
462 | { | 435 | { |
463 | // Start jumping, prejump | 436 | // Start jumping, prejump |
@@ -538,13 +511,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
538 | 511 | ||
539 | // next section moved outside paren. and realigned for jumping | 512 | // next section moved outside paren. and realigned for jumping |
540 | 513 | ||
541 | // if (move.X != 0f || move.Y != 0f) | ||
542 | if (heldOnXY) | 514 | if (heldOnXY) |
543 | { | 515 | { |
544 | currentControlState = motionControlStates.onsurface; | 516 | currentControlState = motionControlStates.onsurface; |
545 | Falling = false; | 517 | Falling = false; |
546 | // Walking / crouchwalking / running | 518 | // Walking / crouchwalking / running |
547 | // if (move.Z < 0f) | ||
548 | if (heldDown) | 519 | if (heldDown) |
549 | { | 520 | { |
550 | return "CROUCHWALK"; | 521 | return "CROUCHWALK"; |
@@ -564,7 +535,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
564 | currentControlState = motionControlStates.onsurface; | 535 | currentControlState = motionControlStates.onsurface; |
565 | Falling = false; | 536 | Falling = false; |
566 | // Not walking | 537 | // Not walking |
567 | // if (move.Z < 0) | ||
568 | if(heldDown) | 538 | if(heldDown) |
569 | return "CROUCH"; | 539 | return "CROUCH"; |
570 | else if (heldTurnLeft) | 540 | else if (heldTurnLeft) |
@@ -595,9 +565,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
595 | { | 565 | { |
596 | CurrentMovementAnimation = newMovementAnimation; | 566 | CurrentMovementAnimation = newMovementAnimation; |
597 | 567 | ||
598 | // m_log.DebugFormat( | 568 | // m_log.DebugFormat( |
599 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | 569 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", |
600 | // CurrentMovementAnimation, m_scenePresence.Name); | 570 | // CurrentMovementAnimation, m_scenePresence.Name); |
601 | 571 | ||
602 | // Only set it if it's actually changed, give a script | 572 | // Only set it if it's actually changed, give a script |
603 | // a chance to stop a default animation | 573 | // a chance to stop a default animation |
@@ -701,22 +671,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
701 | /// <param name="objectIDs"></param> | 671 | /// <param name="objectIDs"></param> |
702 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) | 672 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) |
703 | { | 673 | { |
704 | /* | ||
705 | if (m_scenePresence.IsChildAgent) | ||
706 | return; | ||
707 | |||
708 | // m_log.DebugFormat( | ||
709 | // "[SCENE PRESENCE ANIMATOR]: Sending anim pack with animations '{0}', sequence '{1}', uuids '{2}'", | ||
710 | // string.Join(",", Array.ConvertAll<UUID, string>(animations, a => a.ToString())), | ||
711 | // string.Join(",", Array.ConvertAll<int, string>(seqs, s => s.ToString())), | ||
712 | // string.Join(",", Array.ConvertAll<UUID, string>(objectIDs, o => o.ToString()))); | ||
713 | |||
714 | m_scenePresence.Scene.ForEachClient( | ||
715 | delegate(IClientAPI client) | ||
716 | { | ||
717 | client.SendAnimations(animations, seqs, m_scenePresence.ControllingClient.AgentId, objectIDs); | ||
718 | }); | ||
719 | */ | ||
720 | m_scenePresence.SendAnimPack(animations, seqs, objectIDs); | 674 | m_scenePresence.SendAnimPack(animations, seqs, objectIDs); |
721 | } | 675 | } |
722 | 676 | ||