aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs52
1 files changed, 31 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 959d928..a37c68e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -660,18 +660,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
660 m_host.AddScriptLPS(1); 660 m_host.AddScriptLPS(1);
661 661
662 double x,y,z,s; 662 double x,y,z,s;
663 663 v.x *= 0.5;
664 double c1 = Math.Cos(v.x * 0.5); 664 v.y *= 0.5;
665 double c2 = Math.Cos(v.y * 0.5); 665 v.z *= 0.5;
666 double c3 = Math.Cos(v.z * 0.5); 666 double c1 = Math.Cos(v.x);
667 double s1 = Math.Sin(v.x * 0.5); 667 double c2 = Math.Cos(v.y);
668 double s2 = Math.Sin(v.y * 0.5); 668 double c1c2 = c1 * c2;
669 double s3 = Math.Sin(v.z * 0.5); 669 double s1 = Math.Sin(v.x);
670 670 double s2 = Math.Sin(v.y);
671 x = s1 * c2 * c3 + c1 * s2 * s3; 671 double s1s2 = s1 * s2;
672 y = c1 * s2 * c3 - s1 * c2 * s3; 672 double c1s2 = c1 * s2;
673 z = s1 * s2 * c3 + c1 * c2 * s3; 673 double s1c2 = s1 * c2;
674 s = c1 * c2 * c3 - s1 * s2 * s3; 674 double c3 = Math.Cos(v.z);
675 double s3 = Math.Sin(v.z);
676
677 x = s1c2 * c3 + c1s2 * s3;
678 y = c1s2 * c3 - s1c2 * s3;
679 z = s1s2 * c3 + c1c2 * s3;
680 s = c1c2 * c3 - s1s2 * s3;
675 681
676 return new LSL_Rotation(x, y, z, s); 682 return new LSL_Rotation(x, y, z, s);
677 } 683 }
@@ -1911,11 +1917,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1911 Primitive.TextureEntry tex = part.Shape.Textures; 1917 Primitive.TextureEntry tex = part.Shape.Textures;
1912 Color4 texcolor; 1918 Color4 texcolor;
1913 LSL_Vector rgb = new LSL_Vector(); 1919 LSL_Vector rgb = new LSL_Vector();
1920 int nsides = GetNumberOfSides(part);
1921
1914 if (face == ScriptBaseClass.ALL_SIDES) 1922 if (face == ScriptBaseClass.ALL_SIDES)
1915 { 1923 {
1916 int i; 1924 int i;
1917 1925 for (i = 0; i < nsides; i++)
1918 for (i = 0 ; i < GetNumberOfSides(part); i++)
1919 { 1926 {
1920 texcolor = tex.GetFace((uint)i).RGBA; 1927 texcolor = tex.GetFace((uint)i).RGBA;
1921 rgb.x += texcolor.R; 1928 rgb.x += texcolor.R;
@@ -1923,13 +1930,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1923 rgb.z += texcolor.B; 1930 rgb.z += texcolor.B;
1924 } 1931 }
1925 1932
1926 rgb.x /= (float)GetNumberOfSides(part); 1933 float invnsides = 1.0f / (float)nsides;
1927 rgb.y /= (float)GetNumberOfSides(part); 1934
1928 rgb.z /= (float)GetNumberOfSides(part); 1935 rgb.x *= invnsides;
1936 rgb.y *= invnsides;
1937 rgb.z *= invnsides;
1929 1938
1930 return rgb; 1939 return rgb;
1931 } 1940 }
1932 if (face >= 0 && face < GetNumberOfSides(part)) 1941 if (face >= 0 && face < nsides)
1933 { 1942 {
1934 texcolor = tex.GetFace((uint)face).RGBA; 1943 texcolor = tex.GetFace((uint)face).RGBA;
1935 rgb.x = texcolor.R; 1944 rgb.x = texcolor.R;
@@ -2369,8 +2378,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2369 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics 2378 // without the absoluteposition = absoluteposition happening, the doors do not move in the physics
2370 // scene 2379 // scene
2371 PhysicsActor pa = part.PhysActor; 2380 PhysicsActor pa = part.PhysActor;
2372 2381 // only root part rot changes positions
2373 if (pa != null && !pa.IsPhysical) 2382 if (pa != null && !pa.IsPhysical && part == part.ParentGroup.RootPart)
2374 { 2383 {
2375 part.ParentGroup.ResetChildPrimPhysicsPositions(); 2384 part.ParentGroup.ResetChildPrimPhysicsPositions();
2376 } 2385 }
@@ -2422,7 +2431,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2422 public LSL_Rotation llGetLocalRot() 2431 public LSL_Rotation llGetLocalRot()
2423 { 2432 {
2424 m_host.AddScriptLPS(1); 2433 m_host.AddScriptLPS(1);
2425 return new LSL_Rotation(m_host.RotationOffset.X, m_host.RotationOffset.Y, m_host.RotationOffset.Z, m_host.RotationOffset.W); 2434 Quaternion rot = m_host.RotationOffset;
2435 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2426 } 2436 }
2427 2437
2428 public void llSetForce(LSL_Vector force, int local) 2438 public void llSetForce(LSL_Vector force, int local)