diff options
author | UbitUmarov | 2014-07-20 16:03:05 +0100 |
---|---|---|
committer | UbitUmarov | 2014-07-20 16:03:05 +0100 |
commit | d6f56a4f99f19aba06420002d185246dd03ee656 (patch) | |
tree | 639a72716d3d92e8092fa284328c49906766f3e4 | |
parent | remove avn hack on sitted avatars positions (diff) | |
download | opensim-SC-d6f56a4f99f19aba06420002d185246dd03ee656.zip opensim-SC-d6f56a4f99f19aba06420002d185246dd03ee656.tar.gz opensim-SC-d6f56a4f99f19aba06420002d185246dd03ee656.tar.bz2 opensim-SC-d6f56a4f99f19aba06420002d185246dd03ee656.tar.xz |
change avatar standup code
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f54ba9c..d4361b8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1881,6 +1881,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | // (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | 1881 | // (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) |
1882 | // m_updateCount = UPDATE_COUNT; | 1882 | // m_updateCount = UPDATE_COUNT; |
1883 | 1883 | ||
1884 | |||
1884 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 1885 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
1885 | { | 1886 | { |
1886 | StandUp(); | 1887 | StandUp(); |
@@ -1949,10 +1950,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1949 | 1950 | ||
1950 | if (AllowMovement && !SitGround) | 1951 | if (AllowMovement && !SitGround) |
1951 | { | 1952 | { |
1952 | // m_log.DebugFormat("[SCENE PRESENCE]: Initial body rotation {0} for {1}", agentData.BodyRotation, Name); | 1953 | // m_log.DebugFormat("[SCENE PRESENCE]: Initial body rotation {0} for {1}", agentData.BodyRotation, Name); |
1953 | |||
1954 | bool update_rotation = false; | 1954 | bool update_rotation = false; |
1955 | |||
1956 | if (agentData.BodyRotation != Rotation) | 1955 | if (agentData.BodyRotation != Rotation) |
1957 | { | 1956 | { |
1958 | Rotation = agentData.BodyRotation; | 1957 | Rotation = agentData.BodyRotation; |
@@ -2524,49 +2523,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
2524 | } | 2523 | } |
2525 | 2524 | ||
2526 | part.ParentGroup.DeleteAvatar(UUID); | 2525 | part.ParentGroup.DeleteAvatar(UUID); |
2527 | Vector3 sitPartWorldPosition = part.GetWorldPosition(); | 2526 | |
2527 | Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset; | ||
2528 | Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation; | ||
2528 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 2529 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
2529 | 2530 | ||
2530 | ParentID = 0; | 2531 | ParentID = 0; |
2531 | ParentPart = null; | 2532 | ParentPart = null; |
2532 | 2533 | ||
2533 | Quaternion standRotation; | ||
2534 | 2534 | ||
2535 | if (part.SitTargetAvatar == UUID) | 2535 | if (part.SitTargetAvatar == UUID) |
2536 | { | 2536 | standRotation = standRotation * part.SitTargetOrientation; |
2537 | standRotation = part.GetWorldRotation(); | 2537 | else |
2538 | standRotation = part.GetWorldRotation() * m_bodyRot; | ||
2539 | |||
2540 | m_bodyRot = standRotation; | ||
2538 | 2541 | ||
2539 | if (!part.IsRoot) | 2542 | Quaternion standRotationZ = new Quaternion(0,0,standRotation.Z,standRotation.W); |
2540 | standRotation = standRotation * part.SitTargetOrientation; | ||
2541 | // standRotation = part.RotationOffset * part.SitTargetOrientation; | ||
2542 | // else | ||
2543 | // standRotation = part.SitTargetOrientation; | ||
2544 | 2543 | ||
2544 | float t = standRotationZ.W * standRotationZ.W + standRotationZ.Z * standRotationZ.Z; | ||
2545 | if (t > 0) | ||
2546 | { | ||
2547 | t = 1.0f / (float)Math.Sqrt(t); | ||
2548 | standRotationZ.W *= t; | ||
2549 | standRotationZ.Z *= t; | ||
2545 | } | 2550 | } |
2546 | else | 2551 | else |
2547 | { | 2552 | { |
2548 | standRotation = Rotation; | 2553 | standRotationZ.W = 1.0f; |
2554 | standRotationZ.Z = 0f; | ||
2549 | } | 2555 | } |
2550 | 2556 | ||
2551 | //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | 2557 | Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ; |
2552 | //Vector3 standPos = ParentPosition; | ||
2553 | |||
2554 | // Vector3 standPositionAdjustment | ||
2555 | // = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f); | ||
2556 | Vector3 adjustmentForSitPosition = part.SitTargetPosition * part.GetWorldRotation(); | ||
2557 | |||
2558 | // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than | ||
2559 | // hardcoding here. | ||
2560 | Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation; | ||
2561 | 2558 | ||
2562 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPosition + adjustmentForSitPose; | 2559 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; |
2563 | 2560 | ||
2564 | // m_log.DebugFormat( | 2561 | // m_log.DebugFormat( |
2565 | // "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}", | 2562 | // "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}", |
2566 | // standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name); | 2563 | // standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name); |
2567 | 2564 | ||
2568 | Rotation = standRotation; | 2565 | m_pos = standPos; |
2569 | AbsolutePosition = standPos; | ||
2570 | } | 2566 | } |
2571 | 2567 | ||
2572 | // We need to wait until we have calculated proper stand positions before sitting up the physical | 2568 | // We need to wait until we have calculated proper stand positions before sitting up the physical |
@@ -2824,8 +2820,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2824 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); | 2820 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
2825 | bool forceMouselook = part.GetForceMouselook(); | 2821 | bool forceMouselook = part.GetForceMouselook(); |
2826 | 2822 | ||
2827 | Rotation = Orientation; | 2823 | m_bodyRot = Orientation; |
2828 | m_pos = offset; | ||
2829 | 2824 | ||
2830 | if (!part.IsRoot) | 2825 | if (!part.IsRoot) |
2831 | { | 2826 | { |
@@ -2834,6 +2829,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2834 | offset += part.OffsetPosition; | 2829 | offset += part.OffsetPosition; |
2835 | } | 2830 | } |
2836 | 2831 | ||
2832 | m_pos = offset; | ||
2833 | |||
2837 | ControllingClient.SendSitResponse( | 2834 | ControllingClient.SendSitResponse( |
2838 | part.ParentGroup.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); | 2835 | part.ParentGroup.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); |
2839 | 2836 | ||