aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs42
1 files changed, 36 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f67f422..b0996f5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4556,22 +4556,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4556 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) 4556 public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset)
4557 { 4557 {
4558 m_host.AddScriptLPS(1); 4558 m_host.AddScriptLPS(1);
4559 NotImplemented("llGroundSlope"); 4559
4560 return new LSL_Types.Vector3(); 4560 Vector3 pos = m_host.AbsolutePosition + new Vector3((float)offset.x,
4561 (float)offset.y,
4562 (float)offset.z);
4563
4564 Vector3 p0 = new Vector3(pos.X, pos.Y,
4565 (float)llGround(
4566 new LSL_Types.Vector3(pos.X, pos.Y, pos.Z)
4567 ));
4568 Vector3 p1 = new Vector3(pos.X + 1, pos.Y,
4569 (float)llGround(
4570 new LSL_Types.Vector3(pos.X + 1, pos.Y, pos.Z)
4571 ));
4572 Vector3 p2 = new Vector3(pos.X, pos.Y + 1,
4573 (float)llGround(
4574 new LSL_Types.Vector3(pos.X, pos.Y + 1, pos.Z)
4575 ));
4576
4577 Vector3 v0 = new Vector3(
4578 p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
4579 Vector3 v1 = new Vector3(
4580 p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
4581
4582 v0.Normalize();
4583 v1.Normalize();
4584
4585 Vector3 tv = new Vector3();
4586 tv.X = (v0.Y * v1.Z) - (v0.Z * v1.Y);
4587 tv.Y = (v0.Z * v1.X) - (v0.X * v1.Z);
4588 tv.Z = (v0.X * v1.Y) - (v0.Y * v1.X);
4589
4590 return new LSL_Types.Vector3(tv.X, tv.Y, tv.Z);
4561 } 4591 }
4562 4592
4563 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) 4593 public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset)
4564 { 4594 {
4565 m_host.AddScriptLPS(1); 4595 m_host.AddScriptLPS(1);
4566 NotImplemented("llGroundNormal"); 4596 LSL_Types.Vector3 x = llGroundSlope(offset);
4567 return new LSL_Types.Vector3(); 4597 return new LSL_Types.Vector3(x.x, x.y, 1.0);
4568 } 4598 }
4569 4599
4570 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) 4600 public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset)
4571 { 4601 {
4572 m_host.AddScriptLPS(1); 4602 m_host.AddScriptLPS(1);
4573 NotImplemented("llGroundContour"); 4603 LSL_Types.Vector3 x = llGroundSlope(offset);
4574 return new LSL_Types.Vector3(); 4604 return new LSL_Types.Vector3(-x.y, x.x, 0.0);
4575 } 4605 }
4576 4606
4577 public LSL_Types.LSLInteger llGetAttached() 4607 public LSL_Types.LSLInteger llGetAttached()