diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 342 |
1 files changed, 313 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0d19589..57635f5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -133,6 +133,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
133 | [XmlIgnore] | 133 | [XmlIgnore] |
134 | public bool DIE_AT_EDGE; | 134 | public bool DIE_AT_EDGE; |
135 | 135 | ||
136 | [XmlIgnore] | ||
137 | public bool RETURN_AT_EDGE; | ||
138 | |||
139 | [XmlIgnore] | ||
140 | public bool BlockGrab; | ||
141 | |||
142 | [XmlIgnore] | ||
143 | public bool StatusSandbox; | ||
144 | |||
145 | [XmlIgnore] | ||
146 | public Vector3 StatusSandboxPos; | ||
147 | |||
136 | // TODO: This needs to be persisted in next XML version update! | 148 | // TODO: This needs to be persisted in next XML version update! |
137 | [XmlIgnore] | 149 | [XmlIgnore] |
138 | public int[] PayPrice = {-2,-2,-2,-2,-2}; | 150 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
@@ -219,6 +231,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
219 | [XmlIgnore] | 231 | [XmlIgnore] |
220 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 232 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
221 | 233 | ||
234 | [XmlIgnore] | ||
235 | public Quaternion m_APIDTarget = Quaternion.Identity; | ||
236 | |||
237 | [XmlIgnore] | ||
238 | public float m_APIDDamp = 0; | ||
239 | |||
240 | [XmlIgnore] | ||
241 | public float m_APIDStrength = 0; | ||
242 | |||
222 | /// <summary> | 243 | /// <summary> |
223 | /// This part's inventory | 244 | /// This part's inventory |
224 | /// </summary> | 245 | /// </summary> |
@@ -233,6 +254,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
233 | public bool Undoing; | 254 | public bool Undoing; |
234 | 255 | ||
235 | [XmlIgnore] | 256 | [XmlIgnore] |
257 | public bool IgnoreUndoUpdate = false; | ||
258 | |||
259 | [XmlIgnore] | ||
236 | private PrimFlags LocalFlags; | 260 | private PrimFlags LocalFlags; |
237 | [XmlIgnore] | 261 | [XmlIgnore] |
238 | private float m_damage = -1.0f; | 262 | private float m_damage = -1.0f; |
@@ -254,6 +278,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
254 | private string m_text = String.Empty; | 278 | private string m_text = String.Empty; |
255 | private string m_touchName = String.Empty; | 279 | private string m_touchName = String.Empty; |
256 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 280 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
281 | private readonly UndoStack<UndoState> m_redo = new UndoStack<UndoState>(5); | ||
257 | private UUID _creatorID; | 282 | private UUID _creatorID; |
258 | 283 | ||
259 | private bool m_passTouches; | 284 | private bool m_passTouches; |
@@ -506,6 +531,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
506 | } | 531 | } |
507 | } | 532 | } |
508 | 533 | ||
534 | [XmlIgnore] | ||
535 | public Quaternion APIDTarget | ||
536 | { | ||
537 | get { return m_APIDTarget; } | ||
538 | set { m_APIDTarget = value; } | ||
539 | } | ||
540 | |||
541 | [XmlIgnore] | ||
542 | public float APIDDamp | ||
543 | { | ||
544 | get { return m_APIDDamp; } | ||
545 | set { m_APIDDamp = value; } | ||
546 | } | ||
547 | |||
548 | [XmlIgnore] | ||
549 | public float APIDStrength | ||
550 | { | ||
551 | get { return m_APIDStrength; } | ||
552 | set { m_APIDStrength = value; } | ||
553 | } | ||
554 | |||
509 | public ulong RegionHandle | 555 | public ulong RegionHandle |
510 | { | 556 | { |
511 | get { return m_regionHandle; } | 557 | get { return m_regionHandle; } |
@@ -517,6 +563,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
517 | get { return m_scriptAccessPin; } | 563 | get { return m_scriptAccessPin; } |
518 | set { m_scriptAccessPin = (int)value; } | 564 | set { m_scriptAccessPin = (int)value; } |
519 | } | 565 | } |
566 | private SceneObjectPart m_PlaySoundMasterPrim = null; | ||
567 | public SceneObjectPart PlaySoundMasterPrim | ||
568 | { | ||
569 | get { return m_PlaySoundMasterPrim; } | ||
570 | set { m_PlaySoundMasterPrim = value; } | ||
571 | } | ||
572 | |||
573 | private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>(); | ||
574 | public List<SceneObjectPart> PlaySoundSlavePrims | ||
575 | { | ||
576 | get { return m_LoopSoundSlavePrims; } | ||
577 | set { m_LoopSoundSlavePrims = value; } | ||
578 | } | ||
579 | |||
580 | private SceneObjectPart m_LoopSoundMasterPrim = null; | ||
581 | public SceneObjectPart LoopSoundMasterPrim | ||
582 | { | ||
583 | get { return m_LoopSoundMasterPrim; } | ||
584 | set { m_LoopSoundMasterPrim = value; } | ||
585 | } | ||
586 | |||
587 | private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>(); | ||
588 | public List<SceneObjectPart> LoopSoundSlavePrims | ||
589 | { | ||
590 | get { return m_LoopSoundSlavePrims; } | ||
591 | set { m_LoopSoundSlavePrims = value; } | ||
592 | } | ||
520 | 593 | ||
521 | public Byte[] TextureAnimation | 594 | public Byte[] TextureAnimation |
522 | { | 595 | { |
@@ -576,8 +649,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
576 | } | 649 | } |
577 | set | 650 | set |
578 | { | 651 | { |
579 | StoreUndoState(); | ||
580 | |||
581 | m_groupPosition = value; | 652 | m_groupPosition = value; |
582 | PhysicsActor actor = PhysActor; | 653 | PhysicsActor actor = PhysActor; |
583 | if (actor != null) | 654 | if (actor != null) |
@@ -1403,6 +1474,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1403 | { | 1474 | { |
1404 | m_undo.Clear(); | 1475 | m_undo.Clear(); |
1405 | } | 1476 | } |
1477 | lock (m_redo) | ||
1478 | { | ||
1479 | m_redo.Clear(); | ||
1480 | } | ||
1406 | StoreUndoState(); | 1481 | StoreUndoState(); |
1407 | } | 1482 | } |
1408 | 1483 | ||
@@ -1713,6 +1788,66 @@ namespace OpenSim.Region.Framework.Scenes | |||
1713 | return m_parentGroup.RootPart.DIE_AT_EDGE; | 1788 | return m_parentGroup.RootPart.DIE_AT_EDGE; |
1714 | } | 1789 | } |
1715 | 1790 | ||
1791 | public bool GetReturnAtEdge() | ||
1792 | { | ||
1793 | if (m_parentGroup == null) | ||
1794 | return false; | ||
1795 | if (m_parentGroup.IsDeleted) | ||
1796 | return false; | ||
1797 | |||
1798 | return m_parentGroup.RootPart.RETURN_AT_EDGE; | ||
1799 | } | ||
1800 | |||
1801 | public void SetReturnAtEdge(bool p) | ||
1802 | { | ||
1803 | if (m_parentGroup == null) | ||
1804 | return; | ||
1805 | if (m_parentGroup.IsDeleted) | ||
1806 | return; | ||
1807 | |||
1808 | m_parentGroup.RootPart.RETURN_AT_EDGE = p; | ||
1809 | } | ||
1810 | |||
1811 | public bool GetBlockGrab() | ||
1812 | { | ||
1813 | if (m_parentGroup == null) | ||
1814 | return false; | ||
1815 | if (m_parentGroup.IsDeleted) | ||
1816 | return false; | ||
1817 | |||
1818 | return m_parentGroup.RootPart.BlockGrab; | ||
1819 | } | ||
1820 | |||
1821 | public void SetBlockGrab(bool p) | ||
1822 | { | ||
1823 | if (m_parentGroup == null) | ||
1824 | return; | ||
1825 | if (m_parentGroup.IsDeleted) | ||
1826 | return; | ||
1827 | |||
1828 | m_parentGroup.RootPart.BlockGrab = p; | ||
1829 | } | ||
1830 | |||
1831 | public void SetStatusSandbox(bool p) | ||
1832 | { | ||
1833 | if (m_parentGroup == null) | ||
1834 | return; | ||
1835 | if (m_parentGroup.IsDeleted) | ||
1836 | return; | ||
1837 | StatusSandboxPos = m_parentGroup.RootPart.AbsolutePosition; | ||
1838 | m_parentGroup.RootPart.StatusSandbox = p; | ||
1839 | } | ||
1840 | |||
1841 | public bool GetStatusSandbox() | ||
1842 | { | ||
1843 | if (m_parentGroup == null) | ||
1844 | return false; | ||
1845 | if (m_parentGroup.IsDeleted) | ||
1846 | return false; | ||
1847 | |||
1848 | return m_parentGroup.RootPart.StatusSandbox; | ||
1849 | } | ||
1850 | |||
1716 | public int GetAxisRotation(int axis) | 1851 | public int GetAxisRotation(int axis) |
1717 | { | 1852 | { |
1718 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 1853 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
@@ -1924,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1924 | // play the sound. | 2059 | // play the sound. |
1925 | if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) | 2060 | if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) |
1926 | { | 2061 | { |
1927 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); | 2062 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); |
1928 | } | 2063 | } |
1929 | 2064 | ||
1930 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) | 2065 | if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) |
@@ -2499,9 +2634,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2499 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | 2634 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); |
2500 | foreach (ScenePresence p in avatarts) | 2635 | foreach (ScenePresence p in avatarts) |
2501 | { | 2636 | { |
2502 | // TODO: some filtering by distance of avatar | 2637 | if (!(Util.GetDistanceTo(p.AbsolutePosition, AbsolutePosition) >= 100)) |
2503 | 2638 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | |
2504 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | ||
2505 | } | 2639 | } |
2506 | } | 2640 | } |
2507 | 2641 | ||
@@ -2562,7 +2696,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
2562 | 2696 | ||
2563 | public void RotLookAt(Quaternion target, float strength, float damping) | 2697 | public void RotLookAt(Quaternion target, float strength, float damping) |
2564 | { | 2698 | { |
2565 | m_parentGroup.rotLookAt(target, strength, damping); | 2699 | rotLookAt(target, strength, damping); |
2700 | } | ||
2701 | |||
2702 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2703 | { | ||
2704 | if (IsAttachment) | ||
2705 | { | ||
2706 | /* | ||
2707 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2708 | if (avatar != null) | ||
2709 | { | ||
2710 | Rotate the Av? | ||
2711 | } */ | ||
2712 | } | ||
2713 | else | ||
2714 | { | ||
2715 | APIDDamp = damping; | ||
2716 | APIDStrength = strength; | ||
2717 | APIDTarget = target; | ||
2718 | } | ||
2719 | } | ||
2720 | |||
2721 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2722 | { | ||
2723 | APIDDamp = damp; | ||
2724 | APIDStrength = strength; | ||
2725 | APIDTarget = rot; | ||
2726 | } | ||
2727 | |||
2728 | public void stopLookAt() | ||
2729 | { | ||
2730 | APIDTarget = Quaternion.Identity; | ||
2566 | } | 2731 | } |
2567 | 2732 | ||
2568 | /// <summary> | 2733 | /// <summary> |
@@ -2824,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2824 | /// <param name="volume"></param> | 2989 | /// <param name="volume"></param> |
2825 | /// <param name="triggered"></param> | 2990 | /// <param name="triggered"></param> |
2826 | /// <param name="flags"></param> | 2991 | /// <param name="flags"></param> |
2827 | public void SendSound(string sound, double volume, bool triggered, byte flags) | 2992 | public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster) |
2828 | { | 2993 | { |
2829 | if (volume > 1) | 2994 | if (volume > 1) |
2830 | volume = 1; | 2995 | volume = 1; |
@@ -2859,10 +3024,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
2859 | ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); | 3024 | ISoundModule soundModule = m_parentGroup.Scene.RequestModuleInterface<ISoundModule>(); |
2860 | if (soundModule != null) | 3025 | if (soundModule != null) |
2861 | { | 3026 | { |
2862 | if (triggered) | 3027 | if (useMaster) |
2863 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle); | 3028 | { |
3029 | if (isMaster) | ||
3030 | { | ||
3031 | if (triggered) | ||
3032 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3033 | else | ||
3034 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3035 | ParentGroup.PlaySoundMasterPrim = this; | ||
3036 | ownerID = this._ownerID; | ||
3037 | objectID = this.UUID; | ||
3038 | parentID = this.GetRootPartUUID(); | ||
3039 | position = this.AbsolutePosition; // region local | ||
3040 | regionHandle = this.ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3041 | if (triggered) | ||
3042 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3043 | else | ||
3044 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3045 | foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims) | ||
3046 | { | ||
3047 | ownerID = prim._ownerID; | ||
3048 | objectID = prim.UUID; | ||
3049 | parentID = prim.GetRootPartUUID(); | ||
3050 | position = prim.AbsolutePosition; // region local | ||
3051 | regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3052 | if (triggered) | ||
3053 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3054 | else | ||
3055 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3056 | } | ||
3057 | ParentGroup.PlaySoundSlavePrims.Clear(); | ||
3058 | ParentGroup.PlaySoundMasterPrim = null; | ||
3059 | } | ||
3060 | else | ||
3061 | { | ||
3062 | ParentGroup.PlaySoundSlavePrims.Add(this); | ||
3063 | } | ||
3064 | } | ||
2864 | else | 3065 | else |
2865 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags); | 3066 | { |
3067 | if (triggered) | ||
3068 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius); | ||
3069 | else | ||
3070 | soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius); | ||
3071 | } | ||
2866 | } | 3072 | } |
2867 | } | 3073 | } |
2868 | 3074 | ||
@@ -3181,6 +3387,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3181 | hasProfileCut = hasDimple; // is it the same thing? | 3387 | hasProfileCut = hasDimple; // is it the same thing? |
3182 | } | 3388 | } |
3183 | 3389 | ||
3390 | public void SetVehicleFlags(int param, bool remove) | ||
3391 | { | ||
3392 | if (PhysActor != null) | ||
3393 | { | ||
3394 | PhysActor.VehicleFlags(param, remove); | ||
3395 | } | ||
3396 | } | ||
3397 | |||
3184 | public void SetGroup(UUID groupID, IClientAPI client) | 3398 | public void SetGroup(UUID groupID, IClientAPI client) |
3185 | { | 3399 | { |
3186 | _groupID = groupID; | 3400 | _groupID = groupID; |
@@ -3285,27 +3499,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3285 | { | 3499 | { |
3286 | if (!Undoing) | 3500 | if (!Undoing) |
3287 | { | 3501 | { |
3288 | if (m_parentGroup != null) | 3502 | if (!IgnoreUndoUpdate) |
3289 | { | 3503 | { |
3290 | lock (m_undo) | 3504 | if (m_parentGroup != null) |
3291 | { | 3505 | { |
3292 | if (m_undo.Count > 0) | 3506 | lock (m_undo) |
3293 | { | 3507 | { |
3294 | UndoState last = m_undo.Peek(); | 3508 | if (m_undo.Count > 0) |
3295 | if (last != null) | ||
3296 | { | 3509 | { |
3297 | if (last.Compare(this)) | 3510 | UndoState last = m_undo.Peek(); |
3298 | return; | 3511 | if (last != null) |
3512 | { | ||
3513 | if (last.Compare(this)) | ||
3514 | return; | ||
3515 | } | ||
3299 | } | 3516 | } |
3300 | } | ||
3301 | 3517 | ||
3302 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3518 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3303 | { | 3519 | { |
3304 | UndoState nUndo = new UndoState(this); | 3520 | UndoState nUndo = new UndoState(this); |
3305 | 3521 | ||
3306 | m_undo.Push(nUndo); | 3522 | m_undo.Push(nUndo); |
3307 | } | 3523 | } |
3308 | 3524 | ||
3525 | } | ||
3309 | } | 3526 | } |
3310 | } | 3527 | } |
3311 | } | 3528 | } |
@@ -3776,11 +3993,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3776 | lock (m_undo) | 3993 | lock (m_undo) |
3777 | { | 3994 | { |
3778 | if (m_undo.Count > 0) | 3995 | if (m_undo.Count > 0) |
3996 | { | ||
3997 | UndoState nUndo = null; | ||
3998 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3779 | { | 3999 | { |
3780 | UndoState goback = m_undo.Pop(); | 4000 | nUndo = new UndoState(this); |
3781 | if (goback != null) | 4001 | } |
3782 | goback.PlaybackState(this); | 4002 | UndoState goback = m_undo.Pop(); |
4003 | if (goback != null) | ||
4004 | { | ||
4005 | goback.PlaybackState(this); | ||
4006 | if (nUndo != null) | ||
4007 | m_redo.Push(nUndo); | ||
4008 | } | ||
4009 | } | ||
4010 | } | ||
4011 | } | ||
4012 | |||
4013 | public void Redo() | ||
4014 | { | ||
4015 | lock (m_redo) | ||
4016 | { | ||
4017 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
4018 | { | ||
4019 | UndoState nUndo = new UndoState(this); | ||
4020 | |||
4021 | m_undo.Push(nUndo); | ||
3783 | } | 4022 | } |
4023 | UndoState gofwd = m_redo.Pop(); | ||
4024 | if (gofwd != null) | ||
4025 | gofwd.PlayfwdState(this); | ||
3784 | } | 4026 | } |
3785 | } | 4027 | } |
3786 | 4028 | ||
@@ -3827,6 +4069,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3827 | (pos.Z != OffsetPosition.Z)) | 4069 | (pos.Z != OffsetPosition.Z)) |
3828 | { | 4070 | { |
3829 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 4071 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); |
4072 | |||
4073 | if (ParentGroup.RootPart.GetStatusSandbox()) | ||
4074 | { | ||
4075 | if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) | ||
4076 | { | ||
4077 | ParentGroup.RootPart.ScriptSetPhysicsStatus(false); | ||
4078 | newPos = OffsetPosition; | ||
4079 | ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | ||
4080 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false); | ||
4081 | } | ||
4082 | } | ||
4083 | |||
3830 | OffsetPosition = newPos; | 4084 | OffsetPosition = newPos; |
3831 | ScheduleTerseUpdate(); | 4085 | ScheduleTerseUpdate(); |
3832 | } | 4086 | } |
@@ -4119,7 +4373,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4119 | (rot.Z != RotationOffset.Z) || | 4373 | (rot.Z != RotationOffset.Z) || |
4120 | (rot.W != RotationOffset.W)) | 4374 | (rot.W != RotationOffset.W)) |
4121 | { | 4375 | { |
4122 | //StoreUndoState(); | ||
4123 | RotationOffset = rot; | 4376 | RotationOffset = rot; |
4124 | ParentGroup.HasGroupChanged = true; | 4377 | ParentGroup.HasGroupChanged = true; |
4125 | ScheduleTerseUpdate(); | 4378 | ScheduleTerseUpdate(); |
@@ -4303,7 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4303 | else | 4556 | else |
4304 | { | 4557 | { |
4305 | // m_log.DebugFormat( | 4558 | // m_log.DebugFormat( |
4306 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); | 4559 | // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); |
4307 | ScheduleFullUpdate(); | 4560 | ScheduleFullUpdate(); |
4308 | } | 4561 | } |
4309 | } | 4562 | } |
@@ -4421,5 +4674,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
4421 | 4674 | ||
4422 | Inventory.ApplyNextOwnerPermissions(); | 4675 | Inventory.ApplyNextOwnerPermissions(); |
4423 | } | 4676 | } |
4677 | public void UpdateLookAt() | ||
4678 | { | ||
4679 | try | ||
4680 | { | ||
4681 | if (APIDTarget != Quaternion.Identity) | ||
4682 | { | ||
4683 | if (Single.IsNaN(APIDTarget.W) == true) | ||
4684 | { | ||
4685 | APIDTarget = Quaternion.Identity; | ||
4686 | return; | ||
4687 | } | ||
4688 | Quaternion rot = RotationOffset; | ||
4689 | Quaternion dir = (rot - APIDTarget); | ||
4690 | float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f)); | ||
4691 | if (dir.Z > speed) | ||
4692 | { | ||
4693 | rot.Z -= speed; | ||
4694 | } | ||
4695 | if (dir.Z < -speed) | ||
4696 | { | ||
4697 | rot.Z += speed; | ||
4698 | } | ||
4699 | rot.Normalize(); | ||
4700 | UpdateRotation(rot); | ||
4701 | } | ||
4702 | } | ||
4703 | catch (Exception ex) | ||
4704 | { | ||
4705 | m_log.Error("[Physics] " + ex); | ||
4706 | } | ||
4707 | } | ||
4424 | } | 4708 | } |
4425 | } | 4709 | } |