diff options
author | Dahlia Trimble | 2008-07-24 07:45:58 +0000 |
---|---|---|
committer | Dahlia Trimble | 2008-07-24 07:45:58 +0000 |
commit | f74a9bcdc7b0682c1c205e9d640fbfa5f214840b (patch) | |
tree | 6d30a6964db7d79771a4ec7b655077b813f983b3 /OpenSim/Region/ScriptEngine/Common | |
parent | Refactor some tests. (diff) | |
download | opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.zip opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.tar.gz opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.tar.bz2 opensim-SC_OLD-f74a9bcdc7b0682c1c205e9d640fbfa5f214840b.tar.xz |
Implements llSetForce() and llGetForce(). These are experimental and the units may not match the Linden implementation.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 2d5be27..1a60f45 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Region.Environment.Interfaces; | |||
42 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; | 42 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; |
43 | using OpenSim.Region.Environment.Modules.World.Land; | 43 | using OpenSim.Region.Environment.Modules.World.Land; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | using OpenSim.Region.Physics.Manager; | ||
45 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | 46 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; |
46 | 47 | ||
47 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | 48 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
@@ -1578,14 +1579,40 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1578 | public void llSetForce(LSL_Types.Vector3 force, int local) | 1579 | public void llSetForce(LSL_Types.Vector3 force, int local) |
1579 | { | 1580 | { |
1580 | m_host.AddScriptLPS(1); | 1581 | m_host.AddScriptLPS(1); |
1581 | NotImplemented("llSetForce"); | 1582 | //NotImplemented("llSetForce"); |
1583 | |||
1584 | if (m_host.ParentGroup != null) | ||
1585 | { | ||
1586 | if (m_host.ParentGroup.RootPart != null) | ||
1587 | { | ||
1588 | if (local != 0) | ||
1589 | force *= llGetRot(); | ||
1590 | |||
1591 | m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z)); | ||
1592 | } | ||
1593 | } | ||
1582 | } | 1594 | } |
1583 | 1595 | ||
1584 | public LSL_Types.Vector3 llGetForce() | 1596 | public LSL_Types.Vector3 llGetForce() |
1585 | { | 1597 | { |
1598 | LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0); | ||
1599 | |||
1586 | m_host.AddScriptLPS(1); | 1600 | m_host.AddScriptLPS(1); |
1587 | NotImplemented("llGetForce"); | 1601 | //NotImplemented("llGetForce"); |
1588 | return new LSL_Types.Vector3(); | 1602 | //return new LSL_Types.Vector3(); |
1603 | |||
1604 | if (m_host.ParentGroup != null) | ||
1605 | { | ||
1606 | if (m_host.ParentGroup.RootPart != null) | ||
1607 | { | ||
1608 | PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce(); | ||
1609 | force.x = tmpForce.X; | ||
1610 | force.y = tmpForce.Y; | ||
1611 | force.z = tmpForce.Z; | ||
1612 | } | ||
1613 | } | ||
1614 | |||
1615 | return force; | ||
1589 | } | 1616 | } |
1590 | 1617 | ||
1591 | public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) | 1618 | public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) |