Fix regression where mouse look flight direction no longer worked by zeroing x/y rot before sending agent updates, instead of before any agent update processing

It turns out that the x/y rot data in mouselook is needed to implement this and to push the avatar against the ground if walking in mouselook.
Doing this in the terse send so that we preserve mouselook rotation information
varregion
Justin Clark-Casey (justincc) 2013-12-05 02:10:46 +00:00
parent 62a2d7836f
commit 17b32b764a
2 changed files with 26 additions and 14 deletions

View File

@ -5091,7 +5091,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// acceleration = new Vector3(1, 0, 0); // acceleration = new Vector3(1, 0, 0);
angularVelocity = presence.AngularVelocity; angularVelocity = presence.AngularVelocity;
// 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.
rotation = presence.Rotation; rotation = presence.Rotation;
rotation.X = 0;
rotation.Y = 0;
if (sendTexture) if (sendTexture)
textureEntry = presence.Appearance.Texture.GetBytes(); textureEntry = presence.Appearance.Texture.GetBytes();
@ -5207,7 +5218,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
data.OffsetPosition.ToBytes(objectData, 16); data.OffsetPosition.ToBytes(objectData, 16);
// data.Velocity.ToBytes(objectData, 28); // data.Velocity.ToBytes(objectData, 28);
// data.Acceleration.ToBytes(objectData, 40); // data.Acceleration.ToBytes(objectData, 40);
data.Rotation.ToBytes(objectData, 52);
// 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.
Quaternion rot = data.Rotation;
rot.X = 0;
rot.Y = 0;
rot.ToBytes(objectData, 52);
//data.AngularVelocity.ToBytes(objectData, 64); //data.AngularVelocity.ToBytes(objectData, 64);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();

View File

@ -1652,20 +1652,9 @@ namespace OpenSim.Region.Framework.Scenes
bool update_rotation = false; bool update_rotation = false;
// Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis if (agentData.BodyRotation != Rotation)
// 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 = new Quaternion(0, 0, agentData.BodyRotation.Z, agentData.BodyRotation.W); Rotation = agentData.BodyRotation;
update_rotation = true; update_rotation = true;
} }