diff options
author | Charles Krinke | 2008-09-08 01:27:16 +0000 |
---|---|---|
committer | Charles Krinke | 2008-09-08 01:27:16 +0000 |
commit | 9ef43d3e22c253c195db6264d830c6d1b9c43ca0 (patch) | |
tree | 64dfb8578378f7059b12d4c8b3cf4e7e18a88893 /OpenSim/Region/ScriptEngine/Common | |
parent | * Implements llGroundSlope, llGroundNormal and llGroundContour in LSL_Api.cs ... (diff) | |
download | opensim-SC_OLD-9ef43d3e22c253c195db6264d830c6d1b9c43ca0.zip opensim-SC_OLD-9ef43d3e22c253c195db6264d830c6d1b9c43ca0.tar.gz opensim-SC_OLD-9ef43d3e22c253c195db6264d830c6d1b9c43ca0.tar.bz2 opensim-SC_OLD-9ef43d3e22c253c195db6264d830c6d1b9c43ca0.tar.xz |
Add Adam's llGroundSlope, llGroundNormal and
llGroundContour into our Common/LS:L_BuiltIn_Commands
file.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index c142e6d..f0f8b18 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4655,24 +4655,53 @@ 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 | |||
4676 | public LSL_Types.LSLInteger llGetAttached() | 4705 | public LSL_Types.LSLInteger llGetAttached() |
4677 | { | 4706 | { |
4678 | m_host.AddScriptLPS(1); | 4707 | m_host.AddScriptLPS(1); |