diff options
author | UbitUmarov | 2014-10-01 04:32:19 +0100 |
---|---|---|
committer | UbitUmarov | 2014-10-01 04:32:19 +0100 |
commit | 4c8819a14363d33b11b4168c1291b74a1bc930ee (patch) | |
tree | 20d174fb8aa48f18f0f8bd3167ce1831eee23ff9 /OpenSim/Region/Framework | |
parent | do global position X and Y with double precision in autopilot, so (diff) | |
download | opensim-SC_OLD-4c8819a14363d33b11b4168c1291b74a1bc930ee.zip opensim-SC_OLD-4c8819a14363d33b11b4168c1291b74a1bc930ee.tar.gz opensim-SC_OLD-4c8819a14363d33b11b4168c1291b74a1bc930ee.tar.bz2 opensim-SC_OLD-4c8819a14363d33b11b4168c1291b74a1bc930ee.tar.xz |
removed useless unreal inworld movement vector estimation. Do animation state using movement control flags only, on avatar frame of reference. This will hold
valid until the up direction is allowed to be diferent from the world one.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 167 |
1 files changed, 97 insertions, 70 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 1017c1d..56b8b30 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
48 | 48 | ||
49 | public AnimationSet Animations | 49 | public AnimationSet Animations |
50 | { | 50 | { |
51 | get { return m_animations; } | 51 | get { return m_animations; } |
52 | } | 52 | } |
53 | protected AnimationSet m_animations = new AnimationSet(); | 53 | protected AnimationSet m_animations = new AnimationSet(); |
54 | 54 | ||
@@ -61,9 +61,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
61 | private int m_animTickLand; | 61 | private int m_animTickLand; |
62 | private int m_animTickJump; | 62 | private int m_animTickJump; |
63 | 63 | ||
64 | public bool m_jumping = false; | 64 | public bool m_jumping = false; |
65 | 65 | ||
66 | // private int m_landing = 0; | 66 | // private int m_landing = 0; |
67 | 67 | ||
68 | /// <summary> | 68 | /// <summary> |
69 | /// Is the avatar falling? | 69 | /// Is the avatar falling? |
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
76 | /// The scene presence that this animator applies to | 76 | /// The scene presence that this animator applies to |
77 | /// </value> | 77 | /// </value> |
78 | protected ScenePresence m_scenePresence; | 78 | protected ScenePresence m_scenePresence; |
79 | 79 | ||
80 | public ScenePresenceAnimator(ScenePresence sp) | 80 | public ScenePresenceAnimator(ScenePresence sp) |
81 | { | 81 | { |
82 | m_scenePresence = sp; | 82 | m_scenePresence = sp; |
@@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
91 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); | 91 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); |
92 | if (m_scenePresence.Scene.DebugAnimations) | 92 | if (m_scenePresence.Scene.DebugAnimations) |
93 | m_log.DebugFormat( | 93 | m_log.DebugFormat( |
94 | "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", | 94 | "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", |
95 | GetAnimName(animID), animID, m_scenePresence.Name); | 95 | GetAnimName(animID), animID, m_scenePresence.Name); |
96 | 96 | ||
97 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) | 97 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
113 | if (animID == UUID.Zero) | 113 | if (animID == UUID.Zero) |
114 | return; | 114 | return; |
115 | 115 | ||
116 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name); | 116 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name); |
117 | 117 | ||
118 | AddAnimation(animID, objectID); | 118 | AddAnimation(animID, objectID); |
119 | } | 119 | } |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
133 | 133 | ||
134 | if (m_scenePresence.Scene.DebugAnimations) | 134 | if (m_scenePresence.Scene.DebugAnimations) |
135 | m_log.DebugFormat( | 135 | m_log.DebugFormat( |
136 | "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", | 136 | "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", |
137 | GetAnimName(animID), animID, m_scenePresence.Name); | 137 | GetAnimName(animID), animID, m_scenePresence.Name); |
138 | 138 | ||
139 | if (m_animations.Remove(animID, allowNoDefault)) | 139 | if (m_animations.Remove(animID, allowNoDefault)) |
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
155 | else | 155 | else |
156 | m_animations.Remove(animID, false); | 156 | m_animations.Remove(animID, false); |
157 | } | 157 | } |
158 | if(sendPack) | 158 | if (sendPack) |
159 | SendAnimPack(); | 159 | SendAnimPack(); |
160 | } | 160 | } |
161 | 161 | ||
@@ -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 | { |
@@ -299,29 +299,44 @@ 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 | |||
303 | // there is no point on having this meaningless movement values, much less in world coordenates | ||
304 | // situation may change if vertical Axis of avatar is allowed to rotate. | ||
305 | // then jumping etc will need some care | ||
306 | |||
302 | // Create forward and left vectors from the current avatar rotation | 307 | // Create forward and left vectors from the current avatar rotation |
303 | Matrix4 rotMatrix = Matrix4.CreateFromQuaternion(m_scenePresence.Rotation); | 308 | /* yes matrix are better, but getting it from the Quaternion will kill the advantage |
304 | Vector3 fwd = Vector3.Transform(Vector3.UnitX, rotMatrix); | 309 | Matrix4 rotMatrix = Matrix4.CreateFromQuaternion(m_scenePresence.Rotation); |
305 | Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix); | 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; | ||
306 | 316 | ||
307 | // Check control flags | 317 | // Check control flags |
308 | bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS); | 318 | bool heldForward = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_AT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS)) != 0); |
309 | bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); | 319 | bool heldBack = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG)) != 0); |
310 | bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS); | 320 | bool heldLeft = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS)) != 0); |
311 | bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG); | 321 | bool heldRight = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG)) != 0); |
312 | bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; | 322 | bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; |
313 | bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; | 323 | bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; |
314 | bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS; | 324 | // bool heldUp = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_UP_POS | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS)) != 0); |
315 | bool heldDown = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG; | 325 | // excluded nudge up so it doesn't trigger jump state |
326 | bool heldUp = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_UP_POS)) != 0); | ||
327 | bool heldDown = ((controlFlags & (AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG | AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG)) != 0); | ||
316 | //bool flying = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) == AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 328 | //bool flying = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) == AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
317 | //bool mouselook = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) == AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK; | 329 | //bool mouselook = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) == AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK; |
318 | if (heldForward || heldBack || heldLeft || heldRight || heldUp || heldDown) | 330 | |
331 | bool heldOnXY = (heldForward || heldBack || heldLeft || heldRight); | ||
332 | if (heldOnXY || heldUp || heldDown) | ||
319 | { | 333 | { |
320 | heldTurnLeft = false; | 334 | heldTurnLeft = false; |
321 | heldTurnRight = false; | 335 | heldTurnRight = false; |
322 | } | 336 | } |
323 | 337 | ||
324 | // Direction in which the avatar is trying to move | 338 | // Direction in which the avatar is trying to move |
339 | /* | ||
325 | Vector3 move = Vector3.Zero; | 340 | Vector3 move = Vector3.Zero; |
326 | if (heldForward) { move.X += fwd.X; move.Y += fwd.Y; } | 341 | if (heldForward) { move.X += fwd.X; move.Y += fwd.Y; } |
327 | if (heldBack) { move.X -= fwd.X; move.Y -= fwd.Y; } | 342 | if (heldBack) { move.X -= fwd.X; move.Y -= fwd.Y; } |
@@ -329,9 +344,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
329 | if (heldRight) { move.X -= left.X; move.Y -= left.Y; } | 344 | if (heldRight) { move.X -= left.X; move.Y -= left.Y; } |
330 | if (heldUp) { move.Z += 1; } | 345 | if (heldUp) { move.Z += 1; } |
331 | if (heldDown) { move.Z -= 1; } | 346 | if (heldDown) { move.Z -= 1; } |
347 | */ | ||
348 | |||
332 | 349 | ||
333 | // Is the avatar trying to move? | 350 | // Is the avatar trying to move? |
334 | // bool moving = (move != Vector3.Zero); | 351 | // bool moving = (move != Vector3.Zero); |
335 | #endregion Inputs | 352 | #endregion Inputs |
336 | 353 | ||
337 | // no physics actor case | 354 | // no physics actor case |
@@ -340,13 +357,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
340 | // well what to do? | 357 | // well what to do? |
341 | 358 | ||
342 | currentControlState = motionControlStates.onsurface; | 359 | currentControlState = motionControlStates.onsurface; |
343 | if (move.X != 0f || move.Y != 0f) | 360 | // if (move.X != 0f || move.Y != 0f) |
361 | if (heldOnXY) | ||
344 | return "WALK"; | 362 | return "WALK"; |
345 | 363 | ||
346 | return "STAND"; | 364 | return "STAND"; |
347 | } | 365 | } |
348 | 366 | ||
349 | |||
350 | #region Flying | 367 | #region Flying |
351 | 368 | ||
352 | bool isColliding = actor.IsColliding; | 369 | bool isColliding = actor.IsColliding; |
@@ -360,15 +377,19 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
360 | 377 | ||
361 | currentControlState = motionControlStates.flying; | 378 | currentControlState = motionControlStates.flying; |
362 | 379 | ||
363 | if (move.X != 0f || move.Y != 0f) | 380 | // if (move.X != 0f || move.Y != 0f) |
381 | if (heldOnXY) | ||
364 | { | 382 | { |
365 | return (m_scenePresence.Scene.m_useFlySlow ? "FLYSLOW" : "FLY"); | 383 | return (m_scenePresence.Scene.m_useFlySlow ? "FLYSLOW" : "FLY"); |
366 | } | 384 | } |
367 | else if (move.Z > 0f) | 385 | // else if (move.Z > 0f) |
386 | else if (heldUp) | ||
387 | |||
368 | { | 388 | { |
369 | return "HOVER_UP"; | 389 | return "HOVER_UP"; |
370 | } | 390 | } |
371 | else if (move.Z < 0f) | 391 | // else if (move.Z < 0f) |
392 | else if (heldDown) | ||
372 | { | 393 | { |
373 | if (isColliding) | 394 | if (isColliding) |
374 | { | 395 | { |
@@ -423,7 +444,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
423 | } | 444 | } |
424 | 445 | ||
425 | // Check if the user has stopped walking just now | 446 | // Check if the user has stopped walking just now |
426 | if (CurrentMovementAnimation == "WALK" && (move == Vector3.Zero)) | 447 | // if (CurrentMovementAnimation == "WALK" && move == Vector3.Zero)) |
448 | if (CurrentMovementAnimation == "WALK" && !heldOnXY && !heldDown && !heldUp) | ||
427 | return "STAND"; | 449 | return "STAND"; |
428 | 450 | ||
429 | return CurrentMovementAnimation; | 451 | return CurrentMovementAnimation; |
@@ -435,8 +457,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
435 | 457 | ||
436 | #region Jumping // section added for jumping... | 458 | #region Jumping // section added for jumping... |
437 | 459 | ||
438 | if (isColliding && move.Z > 0f && currentControlState != motionControlStates.jumping) | 460 | // if (isColliding && move.Z > 0f && currentControlState != motionControlStates.jumping) |
439 | { | 461 | if (isColliding && heldUp && currentControlState != motionControlStates.jumping) |
462 | { | ||
440 | // Start jumping, prejump | 463 | // Start jumping, prejump |
441 | currentControlState = motionControlStates.jumping; | 464 | currentControlState = motionControlStates.jumping; |
442 | m_jumping = true; | 465 | m_jumping = true; |
@@ -481,7 +504,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
481 | currentControlState = motionControlStates.landing; | 504 | currentControlState = motionControlStates.landing; |
482 | m_animTickLand = Environment.TickCount; | 505 | m_animTickLand = Environment.TickCount; |
483 | // TODO: SOFT_LAND support | 506 | // TODO: SOFT_LAND support |
484 | float fallVsq =m_lastFallVelocity*m_lastFallVelocity; | 507 | float fallVsq = m_lastFallVelocity * m_lastFallVelocity; |
485 | if (fallVsq > 300f) // aprox 20*h | 508 | if (fallVsq > 300f) // aprox 20*h |
486 | return "STANDUP"; | 509 | return "STANDUP"; |
487 | else if (fallVsq > 160f) | 510 | else if (fallVsq > 160f) |
@@ -514,12 +537,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
514 | 537 | ||
515 | 538 | ||
516 | // next section moved outside paren. and realigned for jumping | 539 | // next section moved outside paren. and realigned for jumping |
517 | if (move.X != 0f || move.Y != 0f) | 540 | |
541 | // if (move.X != 0f || move.Y != 0f) | ||
542 | if (heldOnXY) | ||
518 | { | 543 | { |
519 | currentControlState = motionControlStates.onsurface; | 544 | currentControlState = motionControlStates.onsurface; |
520 | Falling = false; | 545 | Falling = false; |
521 | // Walking / crouchwalking / running | 546 | // Walking / crouchwalking / running |
522 | if (move.Z < 0f) | 547 | // if (move.Z < 0f) |
548 | if (heldDown) | ||
523 | { | 549 | { |
524 | return "CROUCHWALK"; | 550 | return "CROUCHWALK"; |
525 | } | 551 | } |
@@ -538,7 +564,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
538 | currentControlState = motionControlStates.onsurface; | 564 | currentControlState = motionControlStates.onsurface; |
539 | Falling = false; | 565 | Falling = false; |
540 | // Not walking | 566 | // Not walking |
541 | if (move.Z < 0) | 567 | // if (move.Z < 0) |
568 | if(heldDown) | ||
542 | return "CROUCH"; | 569 | return "CROUCH"; |
543 | else if (heldTurnLeft) | 570 | else if (heldTurnLeft) |
544 | return "TURNLEFT"; | 571 | return "TURNLEFT"; |
@@ -558,7 +585,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
558 | /// <returns>'true' if the animation was changed</returns> | 585 | /// <returns>'true' if the animation was changed</returns> |
559 | public bool UpdateMovementAnimations() | 586 | public bool UpdateMovementAnimations() |
560 | { | 587 | { |
561 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name); | 588 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name); |
562 | 589 | ||
563 | bool ret = false; | 590 | bool ret = false; |
564 | lock (m_animations) | 591 | lock (m_animations) |
@@ -568,9 +595,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
568 | { | 595 | { |
569 | CurrentMovementAnimation = newMovementAnimation; | 596 | CurrentMovementAnimation = newMovementAnimation; |
570 | 597 | ||
571 | // m_log.DebugFormat( | 598 | // m_log.DebugFormat( |
572 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | 599 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", |
573 | // CurrentMovementAnimation, m_scenePresence.Name); | 600 | // CurrentMovementAnimation, m_scenePresence.Name); |
574 | 601 | ||
575 | // Only set it if it's actually changed, give a script | 602 | // Only set it if it's actually changed, give a script |
576 | // a chance to stop a default animation | 603 | // a chance to stop a default animation |
@@ -606,19 +633,19 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
606 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); | 633 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); |
607 | return animIDs; | 634 | return animIDs; |
608 | } | 635 | } |
609 | 636 | ||
610 | public BinBVHAnimation GenerateRandomAnimation() | 637 | public BinBVHAnimation GenerateRandomAnimation() |
611 | { | 638 | { |
612 | int rnditerations = 3; | 639 | int rnditerations = 3; |
613 | BinBVHAnimation anim = new BinBVHAnimation(); | 640 | BinBVHAnimation anim = new BinBVHAnimation(); |
614 | List<string> parts = new List<string>(); | 641 | List<string> parts = new List<string>(); |
615 | parts.Add("mPelvis");parts.Add("mHead");parts.Add("mTorso"); | 642 | parts.Add("mPelvis"); parts.Add("mHead"); parts.Add("mTorso"); |
616 | parts.Add("mHipLeft");parts.Add("mHipRight");parts.Add("mHipLeft");parts.Add("mKneeLeft"); | 643 | parts.Add("mHipLeft"); parts.Add("mHipRight"); parts.Add("mHipLeft"); parts.Add("mKneeLeft"); |
617 | parts.Add("mKneeRight");parts.Add("mCollarLeft");parts.Add("mCollarRight");parts.Add("mNeck"); | 644 | parts.Add("mKneeRight"); parts.Add("mCollarLeft"); parts.Add("mCollarRight"); parts.Add("mNeck"); |
618 | parts.Add("mElbowLeft");parts.Add("mElbowRight");parts.Add("mWristLeft");parts.Add("mWristRight"); | 645 | parts.Add("mElbowLeft"); parts.Add("mElbowRight"); parts.Add("mWristLeft"); parts.Add("mWristRight"); |
619 | parts.Add("mShoulderLeft");parts.Add("mShoulderRight");parts.Add("mAnkleLeft");parts.Add("mAnkleRight"); | 646 | parts.Add("mShoulderLeft"); parts.Add("mShoulderRight"); parts.Add("mAnkleLeft"); parts.Add("mAnkleRight"); |
620 | parts.Add("mEyeRight");parts.Add("mChest");parts.Add("mToeLeft");parts.Add("mToeRight"); | 647 | parts.Add("mEyeRight"); parts.Add("mChest"); parts.Add("mToeLeft"); parts.Add("mToeRight"); |
621 | parts.Add("mFootLeft");parts.Add("mFootRight");parts.Add("mEyeLeft"); | 648 | parts.Add("mFootLeft"); parts.Add("mFootRight"); parts.Add("mEyeLeft"); |
622 | anim.HandPose = 1; | 649 | anim.HandPose = 1; |
623 | anim.InPoint = 0; | 650 | anim.InPoint = 0; |
624 | anim.OutPoint = (rnditerations * .10f); | 651 | anim.OutPoint = (rnditerations * .10f); |
@@ -642,12 +669,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
642 | for (int i = 0; i < rnditerations; i++) | 669 | for (int i = 0; i < rnditerations; i++) |
643 | { | 670 | { |
644 | anim.Joints[j].rotationkeys[i] = new binBVHJointKey(); | 671 | anim.Joints[j].rotationkeys[i] = new binBVHJointKey(); |
645 | anim.Joints[j].rotationkeys[i].time = (i*.10f); | 672 | anim.Joints[j].rotationkeys[i].time = (i * .10f); |
646 | anim.Joints[j].rotationkeys[i].key_element.X = ((float) rnd.NextDouble()*2 - 1); | 673 | anim.Joints[j].rotationkeys[i].key_element.X = ((float)rnd.NextDouble() * 2 - 1); |
647 | anim.Joints[j].rotationkeys[i].key_element.Y = ((float) rnd.NextDouble()*2 - 1); | 674 | anim.Joints[j].rotationkeys[i].key_element.Y = ((float)rnd.NextDouble() * 2 - 1); |
648 | anim.Joints[j].rotationkeys[i].key_element.Z = ((float) rnd.NextDouble()*2 - 1); | 675 | anim.Joints[j].rotationkeys[i].key_element.Z = ((float)rnd.NextDouble() * 2 - 1); |
649 | anim.Joints[j].positionkeys[i] = new binBVHJointKey(); | 676 | anim.Joints[j].positionkeys[i] = new binBVHJointKey(); |
650 | anim.Joints[j].positionkeys[i].time = (i*.10f); | 677 | anim.Joints[j].positionkeys[i].time = (i * .10f); |
651 | anim.Joints[j].positionkeys[i].key_element.X = 0; | 678 | anim.Joints[j].positionkeys[i].key_element.X = 0; |
652 | anim.Joints[j].positionkeys[i].key_element.Y = 0; | 679 | anim.Joints[j].positionkeys[i].key_element.Y = 0; |
653 | anim.Joints[j].positionkeys[i].key_element.Z = 0; | 680 | anim.Joints[j].positionkeys[i].key_element.Z = 0; |
@@ -674,22 +701,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
674 | /// <param name="objectIDs"></param> | 701 | /// <param name="objectIDs"></param> |
675 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) | 702 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) |
676 | { | 703 | { |
677 | /* | 704 | /* |
678 | if (m_scenePresence.IsChildAgent) | 705 | if (m_scenePresence.IsChildAgent) |
679 | return; | 706 | return; |
680 | 707 | ||
681 | // m_log.DebugFormat( | 708 | // m_log.DebugFormat( |
682 | // "[SCENE PRESENCE ANIMATOR]: Sending anim pack with animations '{0}', sequence '{1}', uuids '{2}'", | 709 | // "[SCENE PRESENCE ANIMATOR]: Sending anim pack with animations '{0}', sequence '{1}', uuids '{2}'", |
683 | // string.Join(",", Array.ConvertAll<UUID, string>(animations, a => a.ToString())), | 710 | // string.Join(",", Array.ConvertAll<UUID, string>(animations, a => a.ToString())), |
684 | // string.Join(",", Array.ConvertAll<int, string>(seqs, s => s.ToString())), | 711 | // string.Join(",", Array.ConvertAll<int, string>(seqs, s => s.ToString())), |
685 | // string.Join(",", Array.ConvertAll<UUID, string>(objectIDs, o => o.ToString()))); | 712 | // string.Join(",", Array.ConvertAll<UUID, string>(objectIDs, o => o.ToString()))); |
686 | 713 | ||
687 | m_scenePresence.Scene.ForEachClient( | 714 | m_scenePresence.Scene.ForEachClient( |
688 | delegate(IClientAPI client) | 715 | delegate(IClientAPI client) |
689 | { | 716 | { |
690 | client.SendAnimations(animations, seqs, m_scenePresence.ControllingClient.AgentId, objectIDs); | 717 | client.SendAnimations(animations, seqs, m_scenePresence.ControllingClient.AgentId, objectIDs); |
691 | }); | 718 | }); |
692 | */ | 719 | */ |
693 | m_scenePresence.SendAnimPack(animations, seqs, objectIDs); | 720 | m_scenePresence.SendAnimPack(animations, seqs, objectIDs); |
694 | } | 721 | } |
695 | 722 | ||
@@ -699,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
699 | sequenceNums = null; | 726 | sequenceNums = null; |
700 | objectIDs = null; | 727 | objectIDs = null; |
701 | 728 | ||
702 | if(m_animations != null) | 729 | if (m_animations != null) |
703 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); | 730 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); |
704 | } | 731 | } |
705 | 732 | ||
@@ -722,7 +749,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
722 | public void SendAnimPack() | 749 | public void SendAnimPack() |
723 | { | 750 | { |
724 | //m_log.Debug("Sending animation pack to all"); | 751 | //m_log.Debug("Sending animation pack to all"); |
725 | 752 | ||
726 | if (m_scenePresence.IsChildAgent) | 753 | if (m_scenePresence.IsChildAgent) |
727 | return; | 754 | return; |
728 | 755 | ||
@@ -732,7 +759,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
732 | 759 | ||
733 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); | 760 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); |
734 | 761 | ||
735 | // SendAnimPack(animIDs, sequenceNums, objectIDs); | 762 | // SendAnimPack(animIDs, sequenceNums, objectIDs); |
736 | m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs); | 763 | m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs); |
737 | } | 764 | } |
738 | 765 | ||