diff options
author | UbitUmarov | 2012-07-10 05:28:47 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-10 05:28:47 +0100 |
commit | 652ac5f66bacb048628bc953497ffe4256676f05 (patch) | |
tree | f8e76c2dfca00d4dcd7168258c109f1c3a64a23c | |
parent | let rotationVelocity or AngularVelocity be setted on prims. Limited to (diff) | |
download | opensim-SC-652ac5f66bacb048628bc953497ffe4256676f05.zip opensim-SC-652ac5f66bacb048628bc953497ffe4256676f05.tar.gz opensim-SC-652ac5f66bacb048628bc953497ffe4256676f05.tar.bz2 opensim-SC-652ac5f66bacb048628bc953497ffe4256676f05.tar.xz |
more work on llSetAngularVelocity()
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 29 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 |
2 files changed, 29 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dd30a59..0f44823 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1845,7 +1845,7 @@ 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 | 1848 | // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future |
1849 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) | 1849 | public void SetVelocity(Vector3 pVel, bool localGlobalTF) |
1850 | { | 1850 | { |
1851 | if (ParentGroup == null || ParentGroup.IsDeleted) | 1851 | if (ParentGroup == null || ParentGroup.IsDeleted) |
@@ -1871,6 +1871,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1871 | 1871 | ||
1872 | ParentGroup.Velocity = pVel; | 1872 | ParentGroup.Velocity = pVel; |
1873 | } | 1873 | } |
1874 | |||
1875 | // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future | ||
1876 | public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF) | ||
1877 | { | ||
1878 | if (ParentGroup == null || ParentGroup.IsDeleted) | ||
1879 | return; | ||
1880 | |||
1881 | if (ParentGroup.IsAttachment) | ||
1882 | return; // don't work on attachments (for now ??) | ||
1883 | |||
1884 | SceneObjectPart root = ParentGroup.RootPart; | ||
1885 | |||
1886 | if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles | ||
1887 | return; | ||
1888 | |||
1889 | PhysicsActor pa = root.PhysActor; | ||
1890 | |||
1891 | if (pa == null || !pa.IsPhysical) | ||
1892 | return; | ||
1893 | |||
1894 | if (localGlobalTF) | ||
1895 | { | ||
1896 | pAngVel = pAngVel * GetWorldRotation(); | ||
1897 | } | ||
1898 | |||
1899 | root.AngularVelocity = pAngVel; | ||
1900 | } | ||
1874 | 1901 | ||
1875 | 1902 | ||
1876 | /// <summary> | 1903 | /// <summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0ee2748..cae7343 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2597,12 +2597,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2597 | 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); |
2598 | } | 2598 | } |
2599 | 2599 | ||
2600 | |||
2601 | public void llSetAngularVelocity(LSL_Vector avel, int local) | 2600 | public void llSetAngularVelocity(LSL_Vector avel, int local) |
2602 | { | 2601 | { |
2603 | m_host.AddScriptLPS(1); | 2602 | m_host.AddScriptLPS(1); |
2604 | // Still not done !!!! | 2603 | m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0); |
2605 | // m_host.SetAngularVelocity(new Vector3((float)avel.x, (float)avel.y, (float)avel.z), local != 0); | ||
2606 | } | 2604 | } |
2607 | 2605 | ||
2608 | public LSL_Vector llGetOmega() | 2606 | public LSL_Vector llGetOmega() |