diff options
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 98a3b29..24c809b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -464,16 +464,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
464 | // if (actor != null) | 464 | // if (actor != null) |
465 | if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting! | 465 | if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting! |
466 | m_pos = actor.Position; | 466 | m_pos = actor.Position; |
467 | 467 | else | |
468 | // If we're sitting, we need to update our position | ||
469 | if (m_parentID != 0) | ||
470 | { | 468 | { |
471 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 469 | // Obtain the correct position of a seated avatar. |
472 | if (part != null) | 470 | // In addition to providing the correct position while |
473 | m_parentPosition = part.AbsolutePosition; | 471 | // the avatar is seated, this value will also |
472 | // be used as the location to unsit to. | ||
473 | // | ||
474 | // If m_parentID is not 0, assume we are a seated avatar | ||
475 | // and we should return the position based on the sittarget | ||
476 | // offset and rotation of the prim we are seated on. | ||
477 | // | ||
478 | // Generally, m_pos will contain the position of the avatar | ||
479 | // in the sim unless the avatar is on a sit target. While | ||
480 | // on a sit target, m_pos will contain the desired offset | ||
481 | // without the parent rotation applied. | ||
482 | if (m_parentID != 0) | ||
483 | { | ||
484 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | ||
485 | if (part != null) | ||
486 | { | ||
487 | return m_parentPosition + (m_pos * part.GetWorldRotation()); | ||
488 | } | ||
489 | else | ||
490 | { | ||
491 | return m_parentPosition + m_pos; | ||
492 | } | ||
493 | } | ||
474 | } | 494 | } |
475 | 495 | ||
476 | return m_parentPosition + m_pos; | 496 | return m_pos; |
477 | } | 497 | } |
478 | set | 498 | set |
479 | { | 499 | { |