diff options
author | Justin Clark-Casey (justincc) | 2014-04-23 19:46:58 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-04-23 19:46:58 +0100 |
commit | 7a5699224e39c21532f232cc4694822f4bb7af4d (patch) | |
tree | ce92461c533351fc42788b4187e891c49b0cdf8d /OpenSim/Region | |
parent | Adjust avatar sit positioning on a target to pretty much exactly match that o... (diff) | |
download | opensim-SC_OLD-7a5699224e39c21532f232cc4694822f4bb7af4d.zip opensim-SC_OLD-7a5699224e39c21532f232cc4694822f4bb7af4d.tar.gz opensim-SC_OLD-7a5699224e39c21532f232cc4694822f4bb7af4d.tar.bz2 opensim-SC_OLD-7a5699224e39c21532f232cc4694822f4bb7af4d.tar.xz |
Fix regression test break on previous commit 328bc3b
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 03ea969..2b84364 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -184,30 +184,31 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
184 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); | 184 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); |
185 | 185 | ||
186 | // This section is copied from ScenePresence.HandleAgentSit(). Correctness is not guaranteed. | 186 | // This section is copied from ScenePresence.HandleAgentSit(). Correctness is not guaranteed. |
187 | Quaternion r = part.SitTargetOrientation; | 187 | double x, y, z, m1, m2; |
188 | double x, y, z, m; | ||
189 | m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; | ||
190 | |||
191 | if (Math.Abs(1.0 - m) > 0.000001) | ||
192 | { | ||
193 | m = 1.0 / Math.Sqrt(m); | ||
194 | r.X *= (float)m; | ||
195 | r.Y *= (float)m; | ||
196 | r.Z *= (float)m; | ||
197 | r.W *= (float)m; | ||
198 | } | ||
199 | 188 | ||
189 | Quaternion r = part.SitTargetOrientation;; | ||
190 | m1 = r.X * r.X + r.Y * r.Y; | ||
191 | m2 = r.Z * r.Z + r.W * r.W; | ||
192 | |||
193 | // Rotate the vector <0, 0, 1> | ||
200 | x = 2 * (r.X * r.Z + r.Y * r.W); | 194 | x = 2 * (r.X * r.Z + r.Y * r.W); |
201 | y = 2 * (-r.X * r.W + r.Y * r.Z); | 195 | y = 2 * (-r.X * r.W + r.Y * r.Z); |
202 | z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; | 196 | z = m2 - m1; |
197 | |||
198 | // Set m to be the square of the norm of r. | ||
199 | double m = m1 + m2; | ||
200 | |||
201 | // This constant is emperically determined to be what is used in SL. | ||
202 | // See also http://opensimulator.org/mantis/view.php?id=7096 | ||
203 | double offset = 0.05; | ||
203 | 204 | ||
204 | Vector3 up = new Vector3((float)x, (float)y, (float)z); | 205 | Vector3 up = new Vector3((float)x, (float)y, (float)z); |
205 | Vector3 sitOffset = up * m_sp.Appearance.AvatarHeight * 0.02638f; | 206 | Vector3 sitOffset = up * (float)offset; |
206 | // End of copied section. | 207 | // End of copied section. |
207 | 208 | ||
208 | Assert.That( | 209 | Assert.That( |
209 | m_sp.AbsolutePosition, | 210 | m_sp.AbsolutePosition, |
210 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + sitOffset + ScenePresence.SIT_TARGET_ADJUSTMENT)); | 211 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition - sitOffset + ScenePresence.SIT_TARGET_ADJUSTMENT)); |
211 | Assert.That(m_sp.PhysicsActor, Is.Null); | 212 | Assert.That(m_sp.PhysicsActor, Is.Null); |
212 | 213 | ||
213 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | 214 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); |