From 62a2d7836fb36f66a0e42b20f4596e517eb52354 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Dec 2013 02:27:40 +0000 Subject: Ignore X and Y body rotations when sent by mouse look. Fixes http://opensimulator.org/mantis/view.php?id=3274 When not in mouselook, avatar only sends rotations around the Z plane (since that's the only way an avatar can rotate). However, in mouselook it also sends X and Y information. But sending X and Y in terse updates causes issues with wrong camera movement in mouselook. So strip out X and Y components for now. If this is an issue, then could strip out before sending avatar terse update, though this generates more cpu work. Thanks to mirceakitsune for suggesting an initial fix --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1dc7e20..dae20a5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1648,12 +1648,24 @@ namespace OpenSim.Region.Framework.Scenes if (AllowMovement && !SitGround) { - Quaternion bodyRotation = agentData.BodyRotation; +// m_log.DebugFormat("[SCENE PRESENCE]: Initial body rotation {0} for {1}", agentData.BodyRotation, Name); + bool update_rotation = false; - if (bodyRotation != Rotation) + // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis + // it rotates around. + // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted + // excessive up and down movements of the camera when looking up and down. + // See http://opensimulator.org/mantis/view.php?id=3274 + // This does not affect head movement, since this is controlled entirely by camera movement rather than + // body rotation. It does not affect sitting avatar since it's the sitting part rotation that takes + // effect, not the avatar rotation. + // However, if we do need to store X and Y rotations in the future, another solution needs to be found + // for the mouselook bug. Possibly, one could strip out X and Y rotations before sending the avatar + // update messages. + if (agentData.BodyRotation.Z != Rotation.Z || agentData.BodyRotation.W != Rotation.W) { - Rotation = bodyRotation; + Rotation = new Quaternion(0, 0, agentData.BodyRotation.Z, agentData.BodyRotation.W); update_rotation = true; } -- cgit v1.1