aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2013-01-31 20:36:20 +0000
committerMelanie2013-01-31 20:36:20 +0000
commitcfa8e9cfa7a5896de07dde5516c0f3120cfe3227 (patch)
tree9a4db20385243426c480405f98deb9aaf0edc033
parentMerge branch 'master' into careminster (diff)
parentChange keyframe motion to use a single timer for all objects. This is required (diff)
downloadopensim-SC_OLD-cfa8e9cfa7a5896de07dde5516c0f3120cfe3227.zip
opensim-SC_OLD-cfa8e9cfa7a5896de07dde5516c0f3120cfe3227.tar.gz
opensim-SC_OLD-cfa8e9cfa7a5896de07dde5516c0f3120cfe3227.tar.bz2
opensim-SC_OLD-cfa8e9cfa7a5896de07dde5516c0f3120cfe3227.tar.xz
Merge branch 'avination' into careminster
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs455
2 files changed, 239 insertions, 239 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 691326c..3c6bbe6 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -935,36 +935,33 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
935 } 935 }
936 private UUID GetDefaultItem(WearableType wearable) 936 private UUID GetDefaultItem(WearableType wearable)
937 { 937 {
938 // These are Urban male.. but it doesn't matter as long as the assets exist. 938 // These are ruth
939 UUID ret = UUID.Zero; 939 UUID ret = UUID.Zero;
940 switch (wearable) 940 switch (wearable)
941 { 941 {
942 case WearableType.Eyes: 942 case WearableType.Eyes:
943 ret = new UUID("46d7f979-c060-0ad6-5d3c-8de38c941c8d"); 943 ret = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
944 break; 944 break;
945 case WearableType.Hair: 945 case WearableType.Hair:
946 ret = new UUID("21ae002d-57af-441a-81ff-86f5f674b9b9"); 946 ret = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
947 break; 947 break;
948 case WearableType.Pants: 948 case WearableType.Pants:
949 ret = new UUID("e3440698-48fd-41ac-af9b-f680547cbef2"); 949 ret = new UUID("00000000-38f9-1111-024e-222222111120");
950 break; 950 break;
951 case WearableType.Shape: 951 case WearableType.Shape:
952 ret = new UUID("7c1f1354-2aba-4e55-8357-1545c2c003ce"); 952 ret = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
953 break; 953 break;
954 case WearableType.Shirt: 954 case WearableType.Shirt:
955 ret = new UUID("f8fefa00-b019-4072-9c04-ff79c65348b9"); 955 ret = new UUID("00000000-38f9-1111-024e-222222111110");
956 break;
957 case WearableType.Shoes:
958 ret = new UUID("6455d2cf-0ee1-4c9a-9812-da03371bf719");
959 break; 956 break;
960 case WearableType.Skin: 957 case WearableType.Skin:
961 ret = new UUID("29c99e80-cf59-4fa0-9f8e-e4a1ccaf2fa3"); 958 ret = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
962 break; 959 break;
963 case WearableType.Socks: 960 case WearableType.Undershirt:
964 ret = new UUID("96472ac3-1e18-49e5-b2e4-17c03791ea96"); 961 ret = new UUID("16499ebb-3208-ec27-2def-481881728f47");
965 break; 962 break;
966 case WearableType.Underpants: 963 case WearableType.Underpants:
967 ret = new UUID("d6c7b174-8a2d-473f-a80f-3b7d7b7b3a96"); 964 ret = new UUID("4ac2e9c7-3671-d229-316a-67717730841d");
968 break; 965 break;
969 } 966 }
970 967
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 5cfba39..5a1fd13 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -22,6 +22,77 @@ using log4net;
22 22
23namespace OpenSim.Region.Framework.Scenes 23namespace OpenSim.Region.Framework.Scenes
24{ 24{
25 public static class KeyframeTimer
26 {
27 private static Timer m_timer;
28 private static Dictionary<KeyframeMotion, object> m_motions = new Dictionary<KeyframeMotion, object>();
29 private static object m_lockObject = new object();
30 private static object m_timerLock = new object();
31 public const double timerInterval = 50.0;
32
33 static KeyframeTimer()
34 {
35 m_timer = new Timer();
36 m_timer.Interval = timerInterval;
37 m_timer.AutoReset = true;
38 m_timer.Elapsed += OnTimer;
39
40 m_timer.Start();
41 }
42
43 private static void OnTimer(object sender, ElapsedEventArgs ea)
44 {
45 if (!Monitor.TryEnter(m_timerLock))
46 return;
47
48 try
49 {
50 List<KeyframeMotion> motions;
51
52 lock (m_lockObject)
53 {
54 motions = new List<KeyframeMotion>(m_motions.Keys);
55 }
56
57 foreach (KeyframeMotion m in motions)
58 {
59 try
60 {
61 m.OnTimer();
62 }
63 catch (Exception inner)
64 {
65 // Don't stop processing
66 }
67 }
68 }
69 catch (Exception e)
70 {
71 // Keep running no matter what
72 }
73 finally
74 {
75 Monitor.Exit(m_timerLock);
76 }
77 }
78
79 public static void Add(KeyframeMotion motion)
80 {
81 lock (m_lockObject)
82 {
83 m_motions[motion] = null;
84 }
85 }
86
87 public static void Remove(KeyframeMotion motion)
88 {
89 lock (m_lockObject)
90 {
91 m_motions.Remove(motion);
92 }
93 }
94 }
95
25 [Serializable] 96 [Serializable]
26 public class KeyframeMotion 97 public class KeyframeMotion
27 { 98 {
@@ -63,18 +134,6 @@ namespace OpenSim.Region.Framework.Scenes
63 134
64 private Keyframe[] m_keyframes; 135 private Keyframe[] m_keyframes;
65 136
66 [NonSerialized()]
67 protected Timer m_timer = null;
68
69 // timer lock
70 [NonSerialized()]
71 private object m_onTimerLock;
72
73 // timer overrun detect
74 // prevents overlap or timer events threads frozen on the lock
75 [NonSerialized()]
76 private bool m_inOnTimer;
77
78 // skip timer events. 137 // skip timer events.
79 //timer.stop doesn't assure there aren't event threads still being fired 138 //timer.stop doesn't assure there aren't event threads still being fired
80 [NonSerialized()] 139 [NonSerialized()]
@@ -102,7 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
102 161
103 private int m_iterations = 0; 162 private int m_iterations = 0;
104 163
105 private const double timerInterval = 50.0; 164 private int m_skipLoops = 0;
106 165
107 public DataFormat Data 166 public DataFormat Data
108 { 167 {
@@ -139,31 +198,16 @@ namespace OpenSim.Region.Framework.Scenes
139 198
140 private void StartTimer() 199 private void StartTimer()
141 { 200 {
142 if (m_timer == null) 201 KeyframeTimer.Add(this);
143 return;
144 m_timerStopped = false; 202 m_timerStopped = false;
145 m_timer.Start();
146 } 203 }
147 204
148 private void StopTimer() 205 private void StopTimer()
149 { 206 {
150 if (m_timer == null || m_timerStopped)
151 return;
152 m_timerStopped = true; 207 m_timerStopped = true;
153 m_timer.Stop(); 208 KeyframeTimer.Remove(this);
154 } 209 }
155 210
156 private void RemoveTimer()
157 {
158 if (m_timer == null)
159 return;
160 m_timerStopped = true;
161 m_timer.Stop();
162 m_timer.Elapsed -= OnTimer;
163 m_timer = null;
164 }
165
166
167 public static KeyframeMotion FromData(SceneObjectGroup grp, Byte[] data) 211 public static KeyframeMotion FromData(SceneObjectGroup grp, Byte[] data)
168 { 212 {
169 KeyframeMotion newMotion = null; 213 KeyframeMotion newMotion = null;
@@ -180,9 +224,7 @@ namespace OpenSim.Region.Framework.Scenes
180 if (grp != null && grp.IsSelected) 224 if (grp != null && grp.IsSelected)
181 newMotion.m_selected = true; 225 newMotion.m_selected = true;
182 226
183 newMotion.m_onTimerLock = new object();
184 newMotion.m_timerStopped = false; 227 newMotion.m_timerStopped = false;
185 newMotion.m_inOnTimer = false;
186 newMotion.m_isCrossing = false; 228 newMotion.m_isCrossing = false;
187 newMotion.m_waitingCrossing = false; 229 newMotion.m_waitingCrossing = false;
188 } 230 }
@@ -196,37 +238,34 @@ namespace OpenSim.Region.Framework.Scenes
196 238
197 public void UpdateSceneObject(SceneObjectGroup grp) 239 public void UpdateSceneObject(SceneObjectGroup grp)
198 { 240 {
199// lock (m_onTimerLock) 241 m_isCrossing = false;
200 { 242 m_waitingCrossing = false;
201 m_isCrossing = false; 243 StopTimer();
202 m_waitingCrossing = false;
203 StopTimer();
204
205 if (grp == null)
206 return;
207 244
208 m_group = grp; 245 if (grp == null)
209 Vector3 grppos = grp.AbsolutePosition; 246 return;
210 Vector3 offset = grppos - m_serializedPosition;
211 // avoid doing it more than once
212 // current this will happen draging a prim to other region
213 m_serializedPosition = grppos;
214 247
215 m_basePosition += offset; 248 m_group = grp;
216 m_currentFrame.Position += offset; 249 Vector3 grppos = grp.AbsolutePosition;
250 Vector3 offset = grppos - m_serializedPosition;
251 // avoid doing it more than once
252 // current this will happen draging a prim to other region
253 m_serializedPosition = grppos;
217 254
218 m_nextPosition += offset; 255 m_basePosition += offset;
256 m_currentFrame.Position += offset;
219 257
220 for (int i = 0; i < m_frames.Count; i++) 258 m_nextPosition += offset;
221 {
222 Keyframe k = m_frames[i];
223 k.Position += offset;
224 m_frames[i]=k;
225 }
226 259
227 if (m_running) 260 for (int i = 0; i < m_frames.Count; i++)
228 Start(); 261 {
262 Keyframe k = m_frames[i];
263 k.Position += offset;
264 m_frames[i]=k;
229 } 265 }
266
267 if (m_running)
268 Start();
230 } 269 }
231 270
232 public KeyframeMotion(SceneObjectGroup grp, PlayMode mode, DataFormat data) 271 public KeyframeMotion(SceneObjectGroup grp, PlayMode mode, DataFormat data)
@@ -241,9 +280,7 @@ namespace OpenSim.Region.Framework.Scenes
241 m_baseRotation = grp.GroupRotation; 280 m_baseRotation = grp.GroupRotation;
242 } 281 }
243 282
244 m_onTimerLock = new object();
245 m_timerStopped = true; 283 m_timerStopped = true;
246 m_inOnTimer = false;
247 m_isCrossing = false; 284 m_isCrossing = false;
248 m_waitingCrossing = false; 285 m_waitingCrossing = false;
249 } 286 }
@@ -296,7 +333,7 @@ namespace OpenSim.Region.Framework.Scenes
296 public void Delete() 333 public void Delete()
297 { 334 {
298 m_running = false; 335 m_running = false;
299 RemoveTimer(); 336 StopTimer();
300 m_isCrossing = false; 337 m_isCrossing = false;
301 m_waitingCrossing = false; 338 m_waitingCrossing = false;
302 m_frames.Clear(); 339 m_frames.Clear();
@@ -309,27 +346,13 @@ namespace OpenSim.Region.Framework.Scenes
309 m_waitingCrossing = false; 346 m_waitingCrossing = false;
310 if (m_keyframes != null && m_group != null && m_keyframes.Length > 0) 347 if (m_keyframes != null && m_group != null && m_keyframes.Length > 0)
311 { 348 {
312 if (m_timer == null)
313 {
314 m_timer = new Timer();
315 m_timer.Interval = timerInterval;
316 m_timer.AutoReset = true;
317 m_timer.Elapsed += OnTimer;
318 }
319 else
320 {
321 StopTimer();
322 m_timer.Interval = timerInterval;
323 }
324
325 m_inOnTimer = false;
326 StartTimer(); 349 StartTimer();
327 m_running = true; 350 m_running = true;
328 } 351 }
329 else 352 else
330 { 353 {
331 m_running = false; 354 m_running = false;
332 RemoveTimer(); 355 StopTimer();
333 } 356 }
334 } 357 }
335 358
@@ -339,7 +362,7 @@ namespace OpenSim.Region.Framework.Scenes
339 m_isCrossing = false; 362 m_isCrossing = false;
340 m_waitingCrossing = false; 363 m_waitingCrossing = false;
341 364
342 RemoveTimer(); 365 StopTimer();
343 366
344 m_basePosition = m_group.AbsolutePosition; 367 m_basePosition = m_group.AbsolutePosition;
345 m_baseRotation = m_group.GroupRotation; 368 m_baseRotation = m_group.GroupRotation;
@@ -354,7 +377,7 @@ namespace OpenSim.Region.Framework.Scenes
354 public void Pause() 377 public void Pause()
355 { 378 {
356 m_running = false; 379 m_running = false;
357 RemoveTimer(); 380 StopTimer();
358 381
359 m_group.RootPart.Velocity = Vector3.Zero; 382 m_group.RootPart.Velocity = Vector3.Zero;
360 m_group.RootPart.AngularVelocity = Vector3.Zero; 383 m_group.RootPart.AngularVelocity = Vector3.Zero;
@@ -377,15 +400,11 @@ namespace OpenSim.Region.Framework.Scenes
377 400
378 int start = 0; 401 int start = 0;
379 int end = m_keyframes.Length; 402 int end = m_keyframes.Length;
380// if (m_mode == PlayMode.PingPong && m_keyframes.Length > 1)
381// end = m_keyframes.Length - 1;
382 403
383 if (direction < 0) 404 if (direction < 0)
384 { 405 {
385 start = m_keyframes.Length - 1; 406 start = m_keyframes.Length - 1;
386 end = -1; 407 end = -1;
387// if (m_mode == PlayMode.PingPong && m_keyframes.Length > 1)
388// end = 0;
389 } 408 }
390 409
391 for (int i = start; i != end ; i += direction) 410 for (int i = start; i != end ; i += direction)
@@ -463,189 +482,172 @@ namespace OpenSim.Region.Framework.Scenes
463 } 482 }
464 } 483 }
465 484
466 protected void OnTimer(object sender, ElapsedEventArgs e) 485 public void OnTimer()
467 { 486 {
468 if (m_timerStopped) // trap events still in air even after a timer.stop 487 if (m_skipLoops > 0)
469 return;
470
471 if (m_inOnTimer) // don't let overruns to happen
472 { 488 {
473 m_log.Warn("[KeyFrame]: timer overrun"); 489 m_skipLoops--;
474 return; 490 return;
475 } 491 }
476 492
493 if (m_timerStopped) // trap events still in air even after a timer.stop
494 return;
495
477 if (m_group == null) 496 if (m_group == null)
478 return; 497 return;
479 498
480 lock (m_onTimerLock) 499 bool update = false;
481 {
482 500
483 m_inOnTimer = true; 501 if (m_selected)
502 {
503 if (m_group.RootPart.Velocity != Vector3.Zero)
504 {
505 m_group.RootPart.Velocity = Vector3.Zero;
506 m_group.SendGroupRootTerseUpdate();
484 507
485 bool update = false; 508 }
509 return;
510 }
486 511
487 try 512 if (m_isCrossing)
513 {
514 // if crossing and timer running then cross failed
515 // wait some time then
516 // retry to set the position that evtually caused the outbound
517 // if still outside region this will call startCrossing below
518 m_isCrossing = false;
519 m_group.AbsolutePosition = m_nextPosition;
520 if (!m_isCrossing)
488 { 521 {
489 if (m_selected) 522 StopTimer();
490 { 523 StartTimer();
491 if (m_group.RootPart.Velocity != Vector3.Zero) 524 }
492 { 525 return;
493 m_group.RootPart.Velocity = Vector3.Zero; 526 }
494 m_group.SendGroupRootTerseUpdate();
495// m_group.RootPart.ScheduleTerseUpdate();
496 527
497 } 528 if (m_frames.Count == 0)
498 m_inOnTimer = false; 529 {
499 return; 530 GetNextList();
500 }
501 531
502 if (m_isCrossing) 532 if (m_frames.Count == 0)
503 { 533 {
504 // if crossing and timer running then cross failed 534 Stop();
505 // wait some time then 535 Scene scene = m_group.Scene;
506 // retry to set the position that evtually caused the outbound
507 // if still outside region this will call startCrossing below
508 m_isCrossing = false;
509 m_group.AbsolutePosition = m_nextPosition;
510 if (!m_isCrossing)
511 {
512 StopTimer();
513 m_timer.Interval = timerInterval;
514 StartTimer();
515 }
516 m_inOnTimer = false;
517 return;
518 }
519 536
520 if (m_frames.Count == 0) 537 IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
538 foreach (IScriptModule m in scriptModules)
521 { 539 {
522 GetNextList(); 540 if (m == null)
541 continue;
542 m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
543 }
523 544
524 if (m_frames.Count == 0) 545 return;
525 { 546 }
526 Stop();
527 m_inOnTimer = false;
528 return;
529 }
530 547
531 m_currentFrame = m_frames[0]; 548 m_currentFrame = m_frames[0];
532 m_currentFrame.TimeMS += (int)timerInterval; 549 m_currentFrame.TimeMS += (int)KeyframeTimer.timerInterval;
533 550
534 //force a update on a keyframe transition 551 //force a update on a keyframe transition
535 update = true; 552 update = true;
536 } 553 }
537 554
538 m_currentFrame.TimeMS -= (int)timerInterval; 555 m_currentFrame.TimeMS -= (int)KeyframeTimer.timerInterval;
539 556
540 // Do the frame processing 557 // Do the frame processing
541 double steps = (double)m_currentFrame.TimeMS / timerInterval; 558 double steps = (double)m_currentFrame.TimeMS / KeyframeTimer.timerInterval;
542 559
543 if (steps <= 0.0) 560 if (steps <= 0.0)
544 { 561 {
545 m_group.RootPart.Velocity = Vector3.Zero; 562 m_group.RootPart.Velocity = Vector3.Zero;
546 m_group.RootPart.AngularVelocity = Vector3.Zero; 563 m_group.RootPart.AngularVelocity = Vector3.Zero;
547 564
548 m_nextPosition = (Vector3)m_currentFrame.Position; 565 m_nextPosition = (Vector3)m_currentFrame.Position;
549 m_group.AbsolutePosition = m_nextPosition; 566 m_group.AbsolutePosition = m_nextPosition;
550 567
551 // we are sending imediate updates, no doing force a extra terseUpdate 568 // we are sending imediate updates, no doing force a extra terseUpdate
552// m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation); 569 // m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation);
553 570
554 m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation; 571 m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation;
555 m_frames.RemoveAt(0); 572 m_frames.RemoveAt(0);
556 if (m_frames.Count > 0) 573 if (m_frames.Count > 0)
557 m_currentFrame = m_frames[0]; 574 m_currentFrame = m_frames[0];
558 575
559 update = true; 576 update = true;
560 } 577 }
561 else 578 else
562 { 579 {
563 float complete = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; 580 float complete = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
564 581
565 Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition; 582 Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition;
566 Vector3 motionThisFrame = v / (float)steps; 583 Vector3 motionThisFrame = v / (float)steps;
567 v = v * 1000 / m_currentFrame.TimeMS; 584 v = v * 1000 / m_currentFrame.TimeMS;
568 585
569 if (Vector3.Mag(motionThisFrame) >= 0.05f) 586 if (Vector3.Mag(motionThisFrame) >= 0.05f)
570 { 587 {
571 // m_group.AbsolutePosition += motionThisFrame; 588 // m_group.AbsolutePosition += motionThisFrame;
572 m_nextPosition = m_group.AbsolutePosition + motionThisFrame; 589 m_nextPosition = m_group.AbsolutePosition + motionThisFrame;
573 m_group.AbsolutePosition = m_nextPosition; 590 m_group.AbsolutePosition = m_nextPosition;
574 591
575 m_group.RootPart.Velocity = v; 592 m_group.RootPart.Velocity = v;
576 update = true; 593 update = true;
577 } 594 }
578 595
579 if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation) 596 if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation)
580 { 597 {
581 Quaternion current = m_group.GroupRotation; 598 Quaternion current = m_group.GroupRotation;
582 599
583 Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, complete); 600 Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, complete);
584 step.Normalize(); 601 step.Normalize();
585/* use simpler change detection 602/* use simpler change detection
586 * float angle = 0; 603* float angle = 0;
587
588 float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W;
589 float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W;
590 float aa_bb = aa * bb;
591
592 if (aa_bb == 0)
593 {
594 angle = 0;
595 }
596 else
597 {
598 float ab = current.X * step.X +
599 current.Y * step.Y +
600 current.Z * step.Z +
601 current.W * step.W;
602 float q = (ab * ab) / aa_bb;
603
604 if (q > 1.0f)
605 {
606 angle = 0;
607 }
608 else
609 {
610 angle = (float)Math.Acos(2 * q - 1);
611 }
612 }
613
614 if (angle > 0.01f)
615 */
616 if(Math.Abs(step.X - current.X) > 0.001f
617 || Math.Abs(step.Y - current.Y) > 0.001f
618 || Math.Abs(step.Z - current.Z) > 0.001f)
619 // assuming w is a dependente var
620 604
621 { 605 float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W;
622// m_group.UpdateGroupRotationR(step); 606 float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W;
623 m_group.RootPart.RotationOffset = step; 607 float aa_bb = aa * bb;
608
609 if (aa_bb == 0)
610 {
611 angle = 0;
612 }
613 else
614 {
615 float ab = current.X * step.X +
616 current.Y * step.Y +
617 current.Z * step.Z +
618 current.W * step.W;
619 float q = (ab * ab) / aa_bb;
624 620
625 //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); 621 if (q > 1.0f)
626 update = true; 622 {
627 } 623 angle = 0;
624 }
625 else
626 {
627 angle = (float)Math.Acos(2 * q - 1);
628 } 628 }
629 } 629 }
630 630
631 if (update) 631 if (angle > 0.01f)
632 m_group.SendGroupRootTerseUpdate(); 632*/
633// m_group.RootPart.ScheduleTerseUpdate(); 633 if(Math.Abs(step.X - current.X) > 0.001f
634 || Math.Abs(step.Y - current.Y) > 0.001f
635 || Math.Abs(step.Z - current.Z) > 0.001f)
636 // assuming w is a dependente var
634 637
638 {
639// m_group.UpdateGroupRotationR(step);
640 m_group.RootPart.RotationOffset = step;
635 641
642 //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2);
643 update = true;
644 }
636 } 645 }
637 catch ( Exception ex) 646 }
638 {
639 // still happening sometimes
640 // lets try to see where
641 m_log.Warn("[KeyFrame]: timer overrun" + ex.Message);
642 }
643 647
644 finally 648 if (update)
645 { 649 {
646 // make sure we do not let this frozen 650 m_group.SendGroupRootTerseUpdate();
647 m_inOnTimer = false;
648 }
649 } 651 }
650 } 652 }
651 653
@@ -677,7 +679,7 @@ namespace OpenSim.Region.Framework.Scenes
677 m_isCrossing = true; 679 m_isCrossing = true;
678 m_waitingCrossing = true; 680 m_waitingCrossing = true;
679 681
680// to remove / retune to smoth crossings 682 // to remove / retune to smoth crossings
681 if (m_group.RootPart.Velocity != Vector3.Zero) 683 if (m_group.RootPart.Velocity != Vector3.Zero)
682 { 684 {
683 m_group.RootPart.Velocity = Vector3.Zero; 685 m_group.RootPart.Velocity = Vector3.Zero;
@@ -696,9 +698,10 @@ namespace OpenSim.Region.Framework.Scenes
696 m_group.SendGroupRootTerseUpdate(); 698 m_group.SendGroupRootTerseUpdate();
697// m_group.RootPart.ScheduleTerseUpdate(); 699// m_group.RootPart.ScheduleTerseUpdate();
698 700
699 if (m_running && m_timer != null) 701 if (m_running)
700 { 702 {
701 m_timer.Interval = 60000; 703 StopTimer();
704 m_skipLoops = 1200; // 60 seconds
702 StartTimer(); 705 StartTimer();
703 } 706 }
704 } 707 }