diff options
4 files changed, 57 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a48605d..ed32adc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1845,6 +1845,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
1845 | } | 1845 | } |
1846 | } | 1846 | } |
1847 | 1847 | ||
1848 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future | ||
1849 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) | ||
1850 | { | ||
1851 | if (ParentGroup == null || ParentGroup.IsDeleted) | ||
1852 | return; | ||
1853 | |||
1854 | if (ParentGroup.IsAttachment) | ||
1855 | return; // don't work on attachments (for now ??) | ||
1856 | |||
1857 | SceneObjectPart root = ParentGroup.RootPart; | ||
1858 | |||
1859 | if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles | ||
1860 | return; | ||
1861 | |||
1862 | PhysicsActor pa = root.PhysActor; | ||
1863 | |||
1864 | if (pa == null || !pa.IsPhysical) | ||
1865 | return; | ||
1866 | |||
1867 | if (localGlobalTF) | ||
1868 | { | ||
1869 | pVel = pVel * GetWorldRotation(); | ||
1870 | } | ||
1871 | |||
1872 | ParentGroup.Velocity = pVel; | ||
1873 | } | ||
1874 | |||
1875 | |||
1848 | /// <summary> | 1876 | /// <summary> |
1849 | /// hook to the physics scene to apply angular impulse | 1877 | /// hook to the physics scene to apply angular impulse |
1850 | /// This is sent up to the group, which then finds the root prim | 1878 | /// This is sent up to the group, which then finds the root prim |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5808594..0ee2748 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2538,6 +2538,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2538 | m_host.ApplyImpulse(v, local != 0); | 2538 | m_host.ApplyImpulse(v, local != 0); |
2539 | } | 2539 | } |
2540 | 2540 | ||
2541 | |||
2541 | public void llApplyRotationalImpulse(LSL_Vector force, int local) | 2542 | public void llApplyRotationalImpulse(LSL_Vector force, int local) |
2542 | { | 2543 | { |
2543 | m_host.AddScriptLPS(1); | 2544 | m_host.AddScriptLPS(1); |
@@ -2564,6 +2565,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2564 | llSetTorque(torque, local); | 2565 | llSetTorque(torque, local); |
2565 | } | 2566 | } |
2566 | 2567 | ||
2568 | public void llSetVelocity(LSL_Vector vel, int local) | ||
2569 | { | ||
2570 | m_host.AddScriptLPS(1); | ||
2571 | m_host.SetVelocity(new Vector3((float)vel.x, (float)vel.y, (float)vel.z), local != 0); | ||
2572 | } | ||
2573 | |||
2567 | public LSL_Vector llGetVel() | 2574 | public LSL_Vector llGetVel() |
2568 | { | 2575 | { |
2569 | m_host.AddScriptLPS(1); | 2576 | m_host.AddScriptLPS(1); |
@@ -2590,10 +2597,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2590 | return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); | 2597 | return new LSL_Vector(m_host.Acceleration.X, m_host.Acceleration.Y, m_host.Acceleration.Z); |
2591 | } | 2598 | } |
2592 | 2599 | ||
2600 | |||
2601 | public void llSetAngularVelocity(LSL_Vector avel, int local) | ||
2602 | { | ||
2603 | m_host.AddScriptLPS(1); | ||
2604 | // Still not done !!!! | ||
2605 | // m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0); | ||
2606 | } | ||
2607 | |||
2593 | public LSL_Vector llGetOmega() | 2608 | public LSL_Vector llGetOmega() |
2594 | { | 2609 | { |
2595 | m_host.AddScriptLPS(1); | 2610 | m_host.AddScriptLPS(1); |
2596 | return new LSL_Vector(m_host.AngularVelocity.X, m_host.AngularVelocity.Y, m_host.AngularVelocity.Z); | 2611 | Vector3 avel = m_host.AngularVelocity; |
2612 | return new LSL_Vector(avel.X, avel.Y, avel.Z); | ||
2597 | } | 2613 | } |
2598 | 2614 | ||
2599 | public LSL_Float llGetTimeOfDay() | 2615 | public LSL_Float llGetTimeOfDay() |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 50f520a..40ae495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -328,6 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
328 | void llSensorRemove(); | 328 | void llSensorRemove(); |
329 | void llSensorRepeat(string name, string id, int type, double range, double arc, double rate); | 329 | void llSensorRepeat(string name, string id, int type, double range, double arc, double rate); |
330 | void llSetAlpha(double alpha, int face); | 330 | void llSetAlpha(double alpha, int face); |
331 | void llSetAngularVelocity(LSL_Vector angvelocity, int local); | ||
331 | void llSetBuoyancy(double buoyancy); | 332 | void llSetBuoyancy(double buoyancy); |
332 | void llSetCameraAtOffset(LSL_Vector offset); | 333 | void llSetCameraAtOffset(LSL_Vector offset); |
333 | void llSetCameraEyeOffset(LSL_Vector offset); | 334 | void llSetCameraEyeOffset(LSL_Vector offset); |
@@ -376,6 +377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
376 | void llSetVehicleRotationParam(int param, LSL_Rotation rot); | 377 | void llSetVehicleRotationParam(int param, LSL_Rotation rot); |
377 | void llSetVehicleType(int type); | 378 | void llSetVehicleType(int type); |
378 | void llSetVehicleVectorParam(int param, LSL_Vector vec); | 379 | void llSetVehicleVectorParam(int param, LSL_Vector vec); |
380 | void llSetVelocity(LSL_Vector velocity, int local); | ||
379 | void llShout(int channelID, string text); | 381 | void llShout(int channelID, string text); |
380 | LSL_Float llSin(double f); | 382 | LSL_Float llSin(double f); |
381 | void llSitTarget(LSL_Vector offset, LSL_Rotation rot); | 383 | void llSitTarget(LSL_Vector offset, LSL_Rotation rot); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 116f639..2f8e169 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -1475,6 +1475,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1475 | m_LSL_Functions.llSetAlpha(alpha, face); | 1475 | m_LSL_Functions.llSetAlpha(alpha, face); |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | public void llSetAngularVelocity(LSL_Vector angvelocity, int local) | ||
1479 | { | ||
1480 | m_LSL_Functions.llSetAngularVelocity(angvelocity, local); | ||
1481 | } | ||
1482 | |||
1478 | public void llSetBuoyancy(double buoyancy) | 1483 | public void llSetBuoyancy(double buoyancy) |
1479 | { | 1484 | { |
1480 | m_LSL_Functions.llSetBuoyancy(buoyancy); | 1485 | m_LSL_Functions.llSetBuoyancy(buoyancy); |
@@ -1705,6 +1710,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1705 | m_LSL_Functions.llSetVehicleVectorParam(param, vec); | 1710 | m_LSL_Functions.llSetVehicleVectorParam(param, vec); |
1706 | } | 1711 | } |
1707 | 1712 | ||
1713 | public void llSetVelocity(LSL_Vector velocity, int local) | ||
1714 | { | ||
1715 | m_LSL_Functions.llSetVelocity(velocity, local); | ||
1716 | } | ||
1717 | |||
1708 | public void llShout(int channelID, string text) | 1718 | public void llShout(int channelID, string text) |
1709 | { | 1719 | { |
1710 | m_LSL_Functions.llShout(channelID, text); | 1720 | m_LSL_Functions.llShout(channelID, text); |