aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs58
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs16
3 files changed, 92 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4fb0afb..6e01d2d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -329,6 +329,7 @@ namespace OpenSim.Region.Framework.Scenes
329 get { return (RootPart.Flags & PrimFlags.Physics) != 0; } 329 get { return (RootPart.Flags & PrimFlags.Physics) != 0; }
330 } 330 }
331 331
332
332 /// <summary> 333 /// <summary>
333 /// Is this scene object temporary? 334 /// Is this scene object temporary?
334 /// </summary> 335 /// </summary>
@@ -2536,6 +2537,58 @@ namespace OpenSim.Region.Framework.Scenes
2536 } 2537 }
2537 } 2538 }
2538 2539
2540 public void RotLookAt(Quaternion target, float strength, float damping)
2541 {
2542 if(IsDeleted)
2543 return;
2544
2545 // non physical is handle in LSL api
2546 if(!UsesPhysics || IsAttachment)
2547 return;
2548
2549 SceneObjectPart rootpart = m_rootPart;
2550 if (rootpart != null)
2551 {
2552/* physics still doesnt suport this
2553 if (rootpart.PhysActor != null)
2554 {
2555 rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
2556 rootpart.PhysActor.APIDStrength = strength;
2557 rootpart.PhysActor.APIDDamping = damping;
2558 rootpart.PhysActor.APIDActive = true;
2559 }
2560*/
2561 // so do it in rootpart
2562 rootpart.RotLookAt(target, strength, damping);
2563 }
2564 }
2565
2566 public void StartLookAt(Quaternion target, float strength, float damping)
2567 {
2568 if(IsDeleted)
2569 return;
2570
2571 // non physical is done by LSL APi
2572 if(!UsesPhysics || IsAttachment)
2573 return;
2574
2575 if (m_rootPart != null)
2576 m_rootPart.RotLookAt(target, strength, damping);
2577 }
2578
2579 public void StopLookAt()
2580 {
2581 SceneObjectPart rootpart = m_rootPart;
2582 if (rootpart != null)
2583 {
2584 if (rootpart.PhysActor != null)
2585 {
2586 rootpart.PhysActor.APIDActive = false;
2587 }
2588
2589 rootpart.StopLookAt();
2590 }
2591 }
2539 /// <summary> 2592 /// <summary>
2540 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. 2593 /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
2541 /// </summary> 2594 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e8d976d..33c1c4e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3091,37 +3091,31 @@ namespace OpenSim.Region.Framework.Scenes
3091 3091
3092 public void RotLookAt(Quaternion target, float strength, float damping) 3092 public void RotLookAt(Quaternion target, float strength, float damping)
3093 { 3093 {
3094 // non physical is done on LSL
3095 // physical is a rootpart thing
3096 if(ParentGroup.IsDeleted) 3094 if(ParentGroup.IsDeleted)
3097 return; 3095 return;
3098 3096
3099 if(ParentGroup.RootPart != this) 3097 // for now we only handle physics case
3100 ParentGroup.RootPart.RotLookAt(target, strength, damping); 3098 if(!ParentGroup.UsesPhysics || ParentGroup.IsAttachment)
3099 return;
3101 3100
3102 if (ParentGroup.IsAttachment) 3101 // physical is SOG
3102 if(ParentGroup.RootPart != this)
3103 { 3103 {
3104 /* 3104 ParentGroup.RotLookAt(target, strength, damping);
3105 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 3105 return;
3106 if (avatar != null)
3107 {
3108 Rotate the Av?
3109 } */
3110 } 3106 }
3111 else
3112 {
3113 APIDDamp = damping;
3114 APIDStrength = strength;
3115 APIDTarget = target;
3116 3107
3117 if (APIDStrength <= 0) 3108 APIDDamp = damping;
3118 { 3109 APIDStrength = strength;
3119 m_log.WarnFormat("[SceneObjectPart] Invalid rotation strength {0}",APIDStrength); 3110 APIDTarget = target;
3120 return; 3111
3121 } 3112 if (APIDStrength <= 0)
3122 3113 {
3123 APIDActive = true; 3114 m_log.WarnFormat("[SceneObjectPart] Invalid rotation strength {0}",APIDStrength);
3115 return;
3124 } 3116 }
3117
3118 APIDActive = true;
3125 3119
3126 // Necessary to get the lookat deltas applied 3120 // Necessary to get the lookat deltas applied
3127 ParentGroup.QueueForUpdateCheck(); 3121 ParentGroup.QueueForUpdateCheck();
@@ -3129,15 +3123,18 @@ namespace OpenSim.Region.Framework.Scenes
3129 3123
3130 public void StartLookAt(Quaternion target, float strength, float damping) 3124 public void StartLookAt(Quaternion target, float strength, float damping)
3131 { 3125 {
3132 // non physical is done on LSL
3133 // physical is a rootpart thing
3134 if(ParentGroup.IsDeleted) 3126 if(ParentGroup.IsDeleted)
3135 return; 3127 return;
3136 3128
3137 if(ParentGroup.RootPart != this) 3129 // non physical is done on LSL
3138 ParentGroup.RootPart.RotLookAt(target, strength, damping); 3130 if(ParentGroup.IsAttachment || !ParentGroup.UsesPhysics)
3131 return;
3139 3132
3140 RotLookAt(target,strength,damping); 3133 // physical is SOG
3134 if(ParentGroup.RootPart != this)
3135 ParentGroup.RotLookAt(target, strength, damping);
3136 else
3137 RotLookAt(target,strength,damping);
3141 } 3138 }
3142 3139
3143 public void StopLookAt() 3140 public void StopLookAt()
@@ -3145,9 +3142,10 @@ namespace OpenSim.Region.Framework.Scenes
3145 if(ParentGroup.IsDeleted) 3142 if(ParentGroup.IsDeleted)
3146 return; 3143 return;
3147 3144
3148 if(ParentGroup.RootPart != this) 3145 if(ParentGroup.RootPart != this && ParentGroup.UsesPhysics)
3149 ParentGroup.RootPart.StopLookAt(); 3146 ParentGroup.StopLookAt();
3150 3147
3148 // just in case do this always
3151 if(APIDActive) 3149 if(APIDActive)
3152 AngularVelocity = Vector3.Zero; 3150 AngularVelocity = Vector3.Zero;
3153 3151
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8d59c2d..a2abbeb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3569,7 +3569,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3569 // and rotate so Z points to target with X below horizont 3569 // and rotate so Z points to target with X below horizont
3570 LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up); 3570 LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
3571 3571
3572 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) 3572 SceneObjectGroup sog = m_host.ParentGroup;
3573 if(sog == null || sog.IsDeleted)
3574 return;
3575
3576 if (!sog.UsesPhysics || sog.IsAttachment)
3573 { 3577 {
3574 // Do nothing if either value is 0 (this has been checked in SL) 3578 // Do nothing if either value is 0 (this has been checked in SL)
3575 if (strength <= 0.0 || damping <= 0.0) 3579 if (strength <= 0.0 || damping <= 0.0)
@@ -3585,7 +3589,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3585 return; 3589 return;
3586 } 3590 }
3587 3591
3588 m_host.StartLookAt(rot, (float)strength, (float)damping); 3592 sog.StartLookAt(rot, (float)strength, (float)damping);
3589 } 3593 }
3590 } 3594 }
3591 3595
@@ -3991,15 +3995,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3991 3995
3992 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply 3996 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
3993 // set the rotation of the object, copy that behavior 3997 // set the rotation of the object, copy that behavior
3994 PhysicsActor pa = m_host.PhysActor; 3998 SceneObjectGroup sog = m_host.ParentGroup;
3999 if(sog == null || sog.IsDeleted)
4000 return;
3995 4001
3996 if (strength == 0 || pa == null || !pa.IsPhysical) 4002 if (strength == 0 || !sog.UsesPhysics || sog.IsAttachment)
3997 { 4003 {
3998 llSetLocalRot(target); 4004 llSetLocalRot(target);
3999 } 4005 }
4000 else 4006 else
4001 { 4007 {
4002 m_host.RotLookAt(target, (float)strength, (float)damping); 4008 sog.RotLookAt(target, (float)strength, (float)damping);
4003 } 4009 }
4004 } 4010 }
4005 4011