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/Shared/Api/Implementation/LSL_Api.cs | |
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/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9832cfc..ed320f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -43,6 +43,7 @@ using OpenSim.Region.Environment.Interfaces; | |||
43 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; | 43 | using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; |
44 | using OpenSim.Region.Environment.Modules.World.Land; | 44 | using OpenSim.Region.Environment.Modules.World.Land; |
45 | using OpenSim.Region.Environment.Scenes; | 45 | using OpenSim.Region.Environment.Scenes; |
46 | using OpenSim.Region.Physics.Manager; | ||
46 | using OpenSim.Region.ScriptEngine.Shared; | 47 | using OpenSim.Region.ScriptEngine.Shared; |
47 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | 48 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; |
48 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 49 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
@@ -1430,14 +1431,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1430 | public void llSetForce(LSL_Types.Vector3 force, int local) | 1431 | public void llSetForce(LSL_Types.Vector3 force, int local) |
1431 | { | 1432 | { |
1432 | m_host.AddScriptLPS(1); | 1433 | m_host.AddScriptLPS(1); |
1433 | NotImplemented("llSetForce"); | 1434 | //NotImplemented("llSetForce"); |
1435 | |||
1436 | if (m_host.ParentGroup != null) | ||
1437 | { | ||
1438 | if (m_host.ParentGroup.RootPart != null) | ||
1439 | { | ||
1440 | if (local != 0) | ||
1441 | force *= llGetRot(); | ||
1442 | |||
1443 | m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z)); | ||
1444 | } | ||
1445 | } | ||
1434 | } | 1446 | } |
1435 | 1447 | ||
1436 | public LSL_Types.Vector3 llGetForce() | 1448 | public LSL_Types.Vector3 llGetForce() |
1437 | { | 1449 | { |
1450 | LSL_Types.Vector3 force = new LSL_Types.Vector3(0.0, 0.0, 0.0); | ||
1451 | |||
1438 | m_host.AddScriptLPS(1); | 1452 | m_host.AddScriptLPS(1); |
1439 | NotImplemented("llGetForce"); | 1453 | //NotImplemented("llGetForce"); |
1440 | return new LSL_Types.Vector3(); | 1454 | //return new LSL_Types.Vector3(); |
1455 | |||
1456 | if (m_host.ParentGroup != null) | ||
1457 | { | ||
1458 | if (m_host.ParentGroup.RootPart != null) | ||
1459 | { | ||
1460 | PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce(); | ||
1461 | force.x = tmpForce.X; | ||
1462 | force.y = tmpForce.Y; | ||
1463 | force.z = tmpForce.Z; | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1467 | return force; | ||
1441 | } | 1468 | } |
1442 | 1469 | ||
1443 | public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) | 1470 | public LSL_Types.LSLInteger llTarget(LSL_Types.Vector3 position, double range) |