diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8c5a9a6..6c4b39d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -383,8 +383,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
383 | } | 383 | } |
384 | 384 | ||
385 | foreach (SceneObjectPart part in m_parts.Values) | 385 | foreach (SceneObjectPart part in m_parts.Values) |
386 | { | ||
386 | part.GroupPosition = val; | 387 | part.GroupPosition = val; |
387 | 388 | } | |
389 | |||
388 | lockPartsForRead(false); | 390 | lockPartsForRead(false); |
389 | 391 | ||
390 | //if (m_rootPart.PhysActor != null) | 392 | //if (m_rootPart.PhysActor != null) |
@@ -1914,13 +1916,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1914 | } | 1916 | } |
1915 | } | 1917 | } |
1916 | 1918 | ||
1919 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
1920 | { | ||
1921 | SceneObjectPart rootpart = m_rootPart; | ||
1922 | if (rootpart != null) | ||
1923 | { | ||
1924 | if (IsAttachment) | ||
1925 | { | ||
1926 | /* | ||
1927 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1928 | if (avatar != null) | ||
1929 | { | ||
1930 | Rotate the Av? | ||
1931 | } */ | ||
1932 | } | ||
1933 | else | ||
1934 | { | ||
1935 | if (rootpart.PhysActor != null) | ||
1936 | { // APID must be implemented in your physics system for this to function. | ||
1937 | rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); | ||
1938 | rootpart.PhysActor.APIDStrength = strength; | ||
1939 | rootpart.PhysActor.APIDDamping = damping; | ||
1940 | rootpart.PhysActor.APIDActive = true; | ||
1941 | } | ||
1942 | } | ||
1943 | } | ||
1944 | } | ||
1945 | |||
1917 | public void stopLookAt() | 1946 | public void stopLookAt() |
1918 | { | 1947 | { |
1919 | SceneObjectPart rootpart = m_rootPart; | 1948 | SceneObjectPart rootpart = m_rootPart; |
1920 | if (rootpart != null) | 1949 | if (rootpart != null) |
1921 | { | 1950 | { |
1922 | if (rootpart.PhysActor != null) | 1951 | if (rootpart.PhysActor != null) |
1923 | { | 1952 | { // APID must be implemented in your physics system for this to function. |
1924 | rootpart.PhysActor.APIDActive = false; | 1953 | rootpart.PhysActor.APIDActive = false; |
1925 | } | 1954 | } |
1926 | } | 1955 | } |
@@ -3345,22 +3374,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3345 | } | 3374 | } |
3346 | 3375 | ||
3347 | lockPartsForRead(true); | 3376 | lockPartsForRead(true); |
3377 | |||
3378 | foreach (SceneObjectPart prim in m_parts.Values) | ||
3348 | { | 3379 | { |
3349 | foreach (SceneObjectPart prim in m_parts.Values) | 3380 | if (prim.UUID != m_rootPart.UUID) |
3350 | { | 3381 | { |
3351 | if (prim.UUID != m_rootPart.UUID) | 3382 | prim.IgnoreUndoUpdate = true; |
3352 | { | 3383 | Vector3 axPos = prim.OffsetPosition; |
3353 | prim.IgnoreUndoUpdate = true; | 3384 | axPos *= oldParentRot; |
3354 | Vector3 axPos = prim.OffsetPosition; | 3385 | axPos *= Quaternion.Inverse(axRot); |
3355 | axPos *= oldParentRot; | 3386 | prim.OffsetPosition = axPos; |
3356 | axPos *= Quaternion.Inverse(axRot); | 3387 | Quaternion primsRot = prim.RotationOffset; |
3357 | prim.OffsetPosition = axPos; | 3388 | Quaternion newRot = primsRot * oldParentRot; |
3358 | Quaternion primsRot = prim.RotationOffset; | 3389 | newRot *= Quaternion.Inverse(axRot); |
3359 | Quaternion newRot = primsRot * oldParentRot; | 3390 | prim.RotationOffset = newRot; |
3360 | newRot *= Quaternion.Inverse(axRot); | 3391 | prim.ScheduleTerseUpdate(); |
3361 | prim.RotationOffset = newRot; | ||
3362 | prim.ScheduleTerseUpdate(); | ||
3363 | } | ||
3364 | } | 3392 | } |
3365 | } | 3393 | } |
3366 | 3394 | ||