diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 58 |
2 files changed, 81 insertions, 30 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 | ||