diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 3df94e8..b2334be 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4655,22 +4655,52 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4655 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) | 4655 | public LSL_Types.Vector3 llGroundSlope(LSL_Types.Vector3 offset) |
4656 | { | 4656 | { |
4657 | m_host.AddScriptLPS(1); | 4657 | m_host.AddScriptLPS(1); |
4658 | NotImplemented("llGroundSlope"); | 4658 | |
4659 | return new LSL_Types.Vector3(); | 4659 | Vector3 pos = m_host.AbsolutePosition + new Vector3((float)offset.x, |
4660 | (float)offset.y, | ||
4661 | (float)offset.z); | ||
4662 | |||
4663 | Vector3 p0 = new Vector3(pos.X, pos.Y, | ||
4664 | (float)llGround( | ||
4665 | new LSL_Types.Vector3(pos.X, pos.Y, pos.Z) | ||
4666 | )); | ||
4667 | Vector3 p1 = new Vector3(pos.X + 1, pos.Y, | ||
4668 | (float)llGround( | ||
4669 | new LSL_Types.Vector3(pos.X + 1, pos.Y, pos.Z) | ||
4670 | )); | ||
4671 | Vector3 p2 = new Vector3(pos.X, pos.Y + 1, | ||
4672 | (float)llGround( | ||
4673 | new LSL_Types.Vector3(pos.X, pos.Y + 1, pos.Z) | ||
4674 | )); | ||
4675 | |||
4676 | Vector3 v0 = new Vector3( | ||
4677 | p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); | ||
4678 | Vector3 v1 = new Vector3( | ||
4679 | p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z); | ||
4680 | |||
4681 | v0.Normalize(); | ||
4682 | v1.Normalize(); | ||
4683 | |||
4684 | Vector3 tv = new Vector3(); | ||
4685 | tv.X = (v0.Y * v1.Z) - (v0.Z * v1.Y); | ||
4686 | tv.Y = (v0.Z * v1.X) - (v0.X * v1.Z); | ||
4687 | tv.Z = (v0.X * v1.Y) - (v0.Y * v1.X); | ||
4688 | |||
4689 | return new LSL_Types.Vector3(tv.X, tv.Y, tv.Z); | ||
4660 | } | 4690 | } |
4661 | 4691 | ||
4662 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) | 4692 | public LSL_Types.Vector3 llGroundNormal(LSL_Types.Vector3 offset) |
4663 | { | 4693 | { |
4664 | m_host.AddScriptLPS(1); | 4694 | m_host.AddScriptLPS(1); |
4665 | NotImplemented("llGroundNormal"); | 4695 | LSL_Types.Vector3 x = llGroundSlope(offset); |
4666 | return new LSL_Types.Vector3(); | 4696 | return new LSL_Types.Vector3(x.x, x.y, 1.0); |
4667 | } | 4697 | } |
4668 | 4698 | ||
4669 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) | 4699 | public LSL_Types.Vector3 llGroundContour(LSL_Types.Vector3 offset) |
4670 | { | 4700 | { |
4671 | m_host.AddScriptLPS(1); | 4701 | m_host.AddScriptLPS(1); |
4672 | NotImplemented("llGroundContour"); | 4702 | LSL_Types.Vector3 x = llGroundSlope(offset); |
4673 | return new LSL_Types.Vector3(); | 4703 | return new LSL_Types.Vector3(-x.y, x.x, 0.0); |
4674 | } | 4704 | } |
4675 | 4705 | ||
4676 | public LSL_Types.LSLInteger llGetAttached() | 4706 | public LSL_Types.LSLInteger llGetAttached() |