diff options
author | Melanie | 2012-04-03 23:52:53 +0100 |
---|---|---|
committer | Melanie | 2012-04-03 23:52:53 +0100 |
commit | 63c44719f7a67950325690bc4cc848b75318e29f (patch) | |
tree | eaa0575671680d8dad75813dc8700d098a3df622 /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | terrain save-tile extensions Signed-off-by: Garmin Kawaguichi <garmin.kawagui... (diff) | |
download | opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.zip opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.tar.gz opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.tar.bz2 opensim-SC-63c44719f7a67950325690bc4cc848b75318e29f.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim')
17 files changed, 292 insertions, 116 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a422552..b64d372 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -36,6 +36,7 @@ using OpenSim.Framework.Capabilities; | |||
36 | using OpenSim.Framework.Client; | 36 | using OpenSim.Framework.Client; |
37 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Region.Physics.Manager; | ||
39 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
40 | 41 | ||
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 42 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
@@ -1761,9 +1762,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1761 | { | 1762 | { |
1762 | if (!grp.IsDeleted) | 1763 | if (!grp.IsDeleted) |
1763 | { | 1764 | { |
1764 | if (grp.RootPart.PhysActor != null) | 1765 | PhysicsActor pa = grp.RootPart.PhysActor; |
1766 | if (pa != null) | ||
1765 | { | 1767 | { |
1766 | grp.RootPart.PhysActor.CrossingFailure(); | 1768 | pa.CrossingFailure(); |
1767 | if (grp.RootPart.KeyframeMotion != null) | 1769 | if (grp.RootPart.KeyframeMotion != null) |
1768 | { | 1770 | { |
1769 | grp.RootPart.Velocity = Vector3.Zero; | 1771 | grp.RootPart.Velocity = Vector3.Zero; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs index 90f124b..fb57c82 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs | |||
@@ -72,5 +72,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
72 | { | 72 | { |
73 | return "BMP"; | 73 | return "BMP"; |
74 | } | 74 | } |
75 | |||
76 | //Returns true if this extension is supported for terrain save-tile | ||
77 | public override bool SupportsTileSave() | ||
78 | { | ||
79 | return false; | ||
80 | } | ||
75 | } | 81 | } |
76 | } | 82 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs index f331b56..79cc50b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs | |||
@@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
57 | { | 57 | { |
58 | return "GIF"; | 58 | return "GIF"; |
59 | } | 59 | } |
60 | |||
61 | //Returns true if this extension is supported for terrain save-tile | ||
62 | public override bool SupportsTileSave() | ||
63 | { | ||
64 | return false; | ||
65 | } | ||
60 | } | 66 | } |
61 | } | 67 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 58925fd..da81dc1 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -177,6 +177,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
177 | return "SYS.DRAWING"; | 177 | return "SYS.DRAWING"; |
178 | } | 178 | } |
179 | 179 | ||
180 | //Returns true if this extension is supported for terrain save-tile | ||
181 | public virtual bool SupportsTileSave() | ||
182 | { | ||
183 | return false; | ||
184 | } | ||
185 | |||
180 | /// <summary> | 186 | /// <summary> |
181 | /// Protected method, generates a grayscale bitmap | 187 | /// Protected method, generates a grayscale bitmap |
182 | /// image from a specified terrain channel. | 188 | /// image from a specified terrain channel. |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs index 1a0d8ec..699d67a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs | |||
@@ -91,6 +91,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
91 | return "JPEG"; | 91 | return "JPEG"; |
92 | } | 92 | } |
93 | 93 | ||
94 | //Returns true if this extension is supported for terrain save-tile | ||
95 | public bool SupportsTileSave() | ||
96 | { | ||
97 | return false; | ||
98 | } | ||
99 | |||
94 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) | 100 | private static Bitmap CreateBitmapFromMap(ITerrainChannel map) |
95 | { | 101 | { |
96 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); | 102 | Bitmap gradientmapLd = new Bitmap("defaultstripe.png"); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs index fad7641..62d232e 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs | |||
@@ -254,5 +254,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
254 | { | 254 | { |
255 | return "LL/SL RAW"; | 255 | return "LL/SL RAW"; |
256 | } | 256 | } |
257 | |||
258 | //Returns true if this extension is supported for terrain save-tile | ||
259 | public bool SupportsTileSave() | ||
260 | { | ||
261 | return false; | ||
262 | } | ||
263 | |||
257 | } | 264 | } |
258 | } | 265 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs index e009ecf..c5c12ae 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs | |||
@@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
57 | { | 57 | { |
58 | return "PNG"; | 58 | return "PNG"; |
59 | } | 59 | } |
60 | |||
61 | //Returns true if this extension is supported for terrain save-tile | ||
62 | public override bool SupportsTileSave() | ||
63 | { | ||
64 | return true; | ||
65 | } | ||
60 | } | 66 | } |
61 | } | 67 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs index ba073ca..9fb7ef7 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs | |||
@@ -173,5 +173,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
173 | { | 173 | { |
174 | return "RAW32"; | 174 | return "RAW32"; |
175 | } | 175 | } |
176 | |||
177 | //Returns true if this extension is supported for terrain save-tile | ||
178 | public bool SupportsTileSave() | ||
179 | { | ||
180 | return false; | ||
181 | } | ||
176 | } | 182 | } |
177 | } | 183 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs index fc1ad33..5d2f893 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs | |||
@@ -57,5 +57,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
57 | { | 57 | { |
58 | return "TIFF"; | 58 | return "TIFF"; |
59 | } | 59 | } |
60 | |||
61 | //Returns true if this extension is supported for terrain save-tile | ||
62 | public bool SupportsTileSave() | ||
63 | { | ||
64 | return false; | ||
65 | } | ||
60 | } | 66 | } |
61 | } | 67 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs index 2f37d9d..1ebf916 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs | |||
@@ -323,6 +323,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
323 | return "Terragen"; | 323 | return "Terragen"; |
324 | } | 324 | } |
325 | 325 | ||
326 | //Returns true if this extension is supported for terrain save-tile | ||
327 | public bool SupportsTileSave() | ||
328 | { | ||
329 | return false; | ||
330 | } | ||
331 | |||
326 | /// <summary> | 332 | /// <summary> |
327 | /// terragen SCAL floats need to be written intel ordered regardless of | 333 | /// terragen SCAL floats need to be written intel ordered regardless of |
328 | /// big or little endian system | 334 | /// big or little endian system |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs index d407617..3ba3657 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs | |||
@@ -32,6 +32,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
32 | { | 32 | { |
33 | public interface ITerrainLoader | 33 | public interface ITerrainLoader |
34 | { | 34 | { |
35 | // Returns true if that extension can be used for terrain save-tile | ||
36 | // (Look into each file in Region.CoreModules.World.Terrain.FileLoaders) | ||
37 | bool SupportsTileSave(); | ||
38 | |||
35 | string FileExtension { get; } | 39 | string FileExtension { get; } |
36 | ITerrainChannel LoadFile(string filename); | 40 | ITerrainChannel LoadFile(string filename); |
37 | ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight); | 41 | ITerrainChannel LoadFile(string filename, int fileStartX, int fileStartY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 14e428e..e2bd769 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -93,6 +93,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
93 | /// </summary> | 93 | /// </summary> |
94 | private string m_supportedFileExtensions = ""; | 94 | private string m_supportedFileExtensions = ""; |
95 | 95 | ||
96 | //For terrain save-tile file extensions | ||
97 | private string m_supportFileExtensionsForTileSave = ""; | ||
98 | |||
96 | #region ICommandableModule Members | 99 | #region ICommandableModule Members |
97 | 100 | ||
98 | public ICommander CommandInterface | 101 | public ICommander CommandInterface |
@@ -148,11 +151,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
148 | 151 | ||
149 | // Generate user-readable extensions list | 152 | // Generate user-readable extensions list |
150 | string supportedFilesSeparator = ""; | 153 | string supportedFilesSeparator = ""; |
154 | string supportedFilesSeparatorForTileSave = ""; | ||
151 | 155 | ||
156 | m_supportFileExtensionsForTileSave = ""; | ||
152 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 157 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) |
153 | { | 158 | { |
154 | m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; | 159 | m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; |
155 | supportedFilesSeparator = ", "; | 160 | supportedFilesSeparator = ", "; |
161 | |||
162 | //For terrain save-tile file extensions | ||
163 | if (loader.Value.SupportsTileSave() == true) | ||
164 | { | ||
165 | m_supportFileExtensionsForTileSave += supportedFilesSeparatorForTileSave + loader.Key + " (" + loader.Value + ")"; | ||
166 | supportedFilesSeparatorForTileSave = ", "; | ||
167 | } | ||
156 | } | 168 | } |
157 | } | 169 | } |
158 | 170 | ||
@@ -589,7 +601,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
589 | // this region is included in the tile request | 601 | // this region is included in the tile request |
590 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 602 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) |
591 | { | 603 | { |
592 | if (filename.EndsWith(loader.Key)) | 604 | if (filename.EndsWith(loader.Key) && loader.Value.SupportsTileSave()) |
593 | { | 605 | { |
594 | lock (m_scene) | 606 | lock (m_scene) |
595 | { | 607 | { |
@@ -610,7 +622,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
610 | 622 | ||
611 | MainConsole.Instance.OutputFormat( | 623 | MainConsole.Instance.OutputFormat( |
612 | "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | 624 | "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", |
613 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | 625 | m_scene.RegionInfo.RegionName, filename, m_supportFileExtensionsForTileSave); |
614 | } | 626 | } |
615 | 627 | ||
616 | /// <summary> | 628 | /// <summary> |
@@ -1194,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1194 | new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); | 1206 | new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); |
1195 | saveToTileCommand.AddArgument("filename", | 1207 | saveToTileCommand.AddArgument("filename", |
1196 | "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + | 1208 | "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + |
1197 | m_supportedFileExtensions, "String"); | 1209 | m_supportFileExtensionsForTileSave, "String"); |
1198 | saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); | 1210 | saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); |
1199 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); | 1211 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); |
1200 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", | 1212 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 539ca14..df37b98 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -666,10 +666,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
666 | 666 | ||
667 | #endregion Region Settings | 667 | #endregion Region Settings |
668 | 668 | ||
669 | MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate", | ||
670 | "reload estate", | ||
671 | "Reload the estate data", HandleReloadEstate); | ||
672 | |||
673 | //Bind Storage Manager functions to some land manager functions for this scene | 669 | //Bind Storage Manager functions to some land manager functions for this scene |
674 | EventManager.OnLandObjectAdded += | 670 | EventManager.OnLandObjectAdded += |
675 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 671 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 9fdbc54..cd4bd42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -348,7 +348,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
348 | if (rot != null) | 348 | if (rot != null) |
349 | sceneObject.UpdateGroupRotationR((Quaternion)rot); | 349 | sceneObject.UpdateGroupRotationR((Quaternion)rot); |
350 | 350 | ||
351 | if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | 351 | PhysicsActor pa = sceneObject.RootPart.PhysActor; |
352 | if (pa != null && pa.IsPhysical && vel != Vector3.Zero) | ||
352 | { | 353 | { |
353 | sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); | 354 | sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); |
354 | sceneObject.Velocity = vel; | 355 | sceneObject.Velocity = vel; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 11fd721..5b47fc0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -725,16 +725,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
725 | { | 725 | { |
726 | m_isSelected = value; | 726 | m_isSelected = value; |
727 | // Tell physics engine that group is selected | 727 | // Tell physics engine that group is selected |
728 | if (m_rootPart.PhysActor != null) | 728 | |
729 | PhysicsActor pa = m_rootPart.PhysActor; | ||
730 | if (pa != null) | ||
729 | { | 731 | { |
730 | m_rootPart.PhysActor.Selected = value; | 732 | pa.Selected = value; |
733 | |||
731 | // Pass it on to the children. | 734 | // Pass it on to the children. |
732 | SceneObjectPart[] parts = m_parts.GetArray(); | 735 | SceneObjectPart[] parts = m_parts.GetArray(); |
733 | for (int i = 0; i < parts.Length; i++) | 736 | for (int i = 0; i < parts.Length; i++) |
734 | { | 737 | { |
735 | SceneObjectPart child = parts[i]; | 738 | SceneObjectPart child = parts[i]; |
736 | if (child.PhysActor != null) | 739 | |
737 | child.PhysActor.Selected = value; | 740 | PhysicsActor childPa = child.PhysActor; |
741 | if (childPa != null) | ||
742 | childPa.Selected = value; | ||
738 | } | 743 | } |
739 | } | 744 | } |
740 | if (RootPart.KeyframeMotion != null) | 745 | if (RootPart.KeyframeMotion != null) |
@@ -2166,29 +2171,58 @@ namespace OpenSim.Region.Framework.Scenes | |||
2166 | } | 2171 | } |
2167 | else | 2172 | else |
2168 | { | 2173 | { |
2169 | if (RootPart.PhysActor != null) | 2174 | PhysicsActor pa = RootPart.PhysActor; |
2175 | |||
2176 | if (pa != null) | ||
2170 | { | 2177 | { |
2171 | RootPart.PhysActor.AddForce(impulse, true); | 2178 | pa.AddForce(impulse, true); |
2172 | m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); | 2179 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2173 | } | 2180 | } |
2174 | } | 2181 | } |
2175 | } | 2182 | } |
2176 | 2183 | ||
2177 | public void applyAngularImpulse(Vector3 impulse) | 2184 | public void applyAngularImpulse(Vector3 impulse) |
2178 | { | 2185 | { |
2179 | if (RootPart.PhysActor != null) | 2186 | PhysicsActor pa = RootPart.PhysActor; |
2187 | |||
2188 | if (pa != null) | ||
2180 | { | 2189 | { |
2181 | if (!IsAttachment) | 2190 | if (!IsAttachment) |
2182 | { | 2191 | { |
2183 | RootPart.PhysActor.AddAngularForce(impulse, true); | 2192 | pa.AddAngularForce(impulse, true); |
2184 | m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); | 2193 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2194 | } | ||
2195 | } | ||
2196 | } | ||
2197 | |||
2198 | public void setAngularImpulse(Vector3 impulse) | ||
2199 | { | ||
2200 | PhysicsActor pa = RootPart.PhysActor; | ||
2201 | |||
2202 | if (pa != null) | ||
2203 | { | ||
2204 | if (!IsAttachment) | ||
2205 | { | ||
2206 | pa.Torque = impulse; | ||
2207 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | ||
2185 | } | 2208 | } |
2186 | } | 2209 | } |
2187 | } | 2210 | } |
2188 | 2211 | ||
2189 | public Vector3 GetTorque() | 2212 | public Vector3 GetTorque() |
2190 | { | 2213 | { |
2191 | return RootPart.Torque; | 2214 | PhysicsActor pa = RootPart.PhysActor; |
2215 | |||
2216 | if (pa != null) | ||
2217 | { | ||
2218 | if (!IsAttachment) | ||
2219 | { | ||
2220 | Vector3 torque = pa.Torque; | ||
2221 | return torque; | ||
2222 | } | ||
2223 | } | ||
2224 | |||
2225 | return Vector3.Zero; | ||
2192 | } | 2226 | } |
2193 | 2227 | ||
2194 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object | 2228 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object |
@@ -2204,19 +2238,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2204 | } | 2238 | } |
2205 | else | 2239 | else |
2206 | { | 2240 | { |
2207 | if (RootPart.PhysActor != null) | 2241 | PhysicsActor pa = RootPart.PhysActor; |
2242 | |||
2243 | if (pa != null) | ||
2208 | { | 2244 | { |
2209 | RootPart.PhysActor.PIDTarget = target; | 2245 | pa.PIDTarget = target; |
2210 | RootPart.PhysActor.PIDTau = tau; | 2246 | pa.PIDTau = tau; |
2211 | RootPart.PhysActor.PIDActive = true; | 2247 | pa.PIDActive = true; |
2212 | } | 2248 | } |
2213 | } | 2249 | } |
2214 | } | 2250 | } |
2215 | 2251 | ||
2216 | public void stopMoveToTarget() | 2252 | public void stopMoveToTarget() |
2217 | { | 2253 | { |
2218 | if (RootPart.PhysActor != null) | 2254 | PhysicsActor pa = RootPart.PhysActor; |
2219 | RootPart.PhysActor.PIDActive = false; | 2255 | |
2256 | if (pa != null) | ||
2257 | pa.PIDActive = false; | ||
2220 | } | 2258 | } |
2221 | 2259 | ||
2222 | public void rotLookAt(Quaternion target, float strength, float damping) | 2260 | public void rotLookAt(Quaternion target, float strength, float damping) |
@@ -2267,18 +2305,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2267 | /// <param name="tau">Number of seconds over which to reach target</param> | 2305 | /// <param name="tau">Number of seconds over which to reach target</param> |
2268 | public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) | 2306 | public void SetHoverHeight(float height, PIDHoverType hoverType, float tau) |
2269 | { | 2307 | { |
2270 | if (RootPart.PhysActor != null) | 2308 | PhysicsActor pa = RootPart.PhysActor; |
2309 | |||
2310 | if (pa != null) | ||
2271 | { | 2311 | { |
2272 | if (height != 0f) | 2312 | if (height != 0f) |
2273 | { | 2313 | { |
2274 | RootPart.PhysActor.PIDHoverHeight = height; | 2314 | pa.PIDHoverHeight = height; |
2275 | RootPart.PhysActor.PIDHoverType = hoverType; | 2315 | pa.PIDHoverType = hoverType; |
2276 | RootPart.PhysActor.PIDTau = tau; | 2316 | pa.PIDTau = tau; |
2277 | RootPart.PhysActor.PIDHoverActive = true; | 2317 | pa.PIDHoverActive = true; |
2278 | } | 2318 | } |
2279 | else | 2319 | else |
2280 | { | 2320 | { |
2281 | RootPart.PhysActor.PIDHoverActive = false; | 2321 | pa.PIDHoverActive = false; |
2282 | } | 2322 | } |
2283 | } | 2323 | } |
2284 | } | 2324 | } |
@@ -2771,10 +2811,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2771 | linkPart.ParentID = 0; | 2811 | linkPart.ParentID = 0; |
2772 | linkPart.LinkNum = 0; | 2812 | linkPart.LinkNum = 0; |
2773 | 2813 | ||
2774 | if (linkPart.PhysActor != null) | 2814 | PhysicsActor linkPartPa = linkPart.PhysActor; |
2775 | { | 2815 | |
2776 | m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); | 2816 | if (linkPartPa != null) |
2777 | } | 2817 | m_scene.PhysicsScene.RemovePrim(linkPartPa); |
2778 | 2818 | ||
2779 | // We need to reset the child part's position | 2819 | // We need to reset the child part's position |
2780 | // ready for life as a separate object after being a part of another object | 2820 | // ready for life as a separate object after being a part of another object |
@@ -2875,17 +2915,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2875 | { | 2915 | { |
2876 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 2916 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
2877 | { | 2917 | { |
2878 | if (m_rootPart.PhysActor != null) | 2918 | PhysicsActor pa = m_rootPart.PhysActor; |
2919 | |||
2920 | if (pa != null) | ||
2879 | { | 2921 | { |
2880 | if (m_rootPart.PhysActor.IsPhysical) | 2922 | if (pa.IsPhysical) |
2881 | { | 2923 | { |
2882 | if (!m_rootPart.BlockGrab) | 2924 | if (!m_rootPart.BlockGrab) |
2883 | { | 2925 | { |
2884 | Vector3 llmoveforce = pos - AbsolutePosition; | 2926 | Vector3 llmoveforce = pos - AbsolutePosition; |
2885 | Vector3 grabforce = llmoveforce; | 2927 | Vector3 grabforce = llmoveforce; |
2886 | grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; | 2928 | grabforce = (grabforce / 10) * pa.Mass; |
2887 | m_rootPart.PhysActor.AddForce(grabforce, true); | 2929 | pa.AddForce(grabforce, true); |
2888 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 2930 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2889 | } | 2931 | } |
2890 | } | 2932 | } |
2891 | else | 2933 | else |
@@ -2915,9 +2957,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2915 | { | 2957 | { |
2916 | if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) | 2958 | if (m_scene.EventManager.TriggerGroupSpinStart(UUID)) |
2917 | { | 2959 | { |
2918 | if (m_rootPart.PhysActor != null) | 2960 | PhysicsActor pa = m_rootPart.PhysActor; |
2961 | |||
2962 | if (pa != null) | ||
2919 | { | 2963 | { |
2920 | if (m_rootPart.PhysActor.IsPhysical) | 2964 | if (pa.IsPhysical) |
2921 | { | 2965 | { |
2922 | m_rootPart.IsWaitingForFirstSpinUpdatePacket = true; | 2966 | m_rootPart.IsWaitingForFirstSpinUpdatePacket = true; |
2923 | } | 2967 | } |
@@ -2958,12 +3002,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2958 | // but it will result in over-shoot or under-shoot of the target orientation. | 3002 | // but it will result in over-shoot or under-shoot of the target orientation. |
2959 | // For the end user, this means that ctrl+shift+drag can be used for relative, | 3003 | // For the end user, this means that ctrl+shift+drag can be used for relative, |
2960 | // but not absolute, adjustments of orientation for physical prims. | 3004 | // but not absolute, adjustments of orientation for physical prims. |
2961 | |||
2962 | if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) | 3005 | if (m_scene.EventManager.TriggerGroupSpin(UUID, newOrientation)) |
2963 | { | 3006 | { |
2964 | if (m_rootPart.PhysActor != null) | 3007 | PhysicsActor pa = m_rootPart.PhysActor; |
3008 | |||
3009 | if (pa != null) | ||
2965 | { | 3010 | { |
2966 | if (m_rootPart.PhysActor.IsPhysical) | 3011 | if (pa.IsPhysical) |
2967 | { | 3012 | { |
2968 | if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) | 3013 | if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) |
2969 | { | 3014 | { |
@@ -2989,9 +3034,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2989 | 3034 | ||
2990 | //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); | 3035 | //m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis); |
2991 | Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); | 3036 | Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z); |
2992 | spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor | 3037 | spinforce = (spinforce/8) * pa.Mass; // 8 is an arbitrary torque scaling factor |
2993 | m_rootPart.PhysActor.AddAngularForce(spinforce,true); | 3038 | pa.AddAngularForce(spinforce,true); |
2994 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 3039 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2995 | } | 3040 | } |
2996 | } | 3041 | } |
2997 | else | 3042 | else |
@@ -3199,8 +3244,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3199 | { | 3244 | { |
3200 | part.UpdateShape(shapeBlock); | 3245 | part.UpdateShape(shapeBlock); |
3201 | 3246 | ||
3202 | if (part.PhysActor != null) | 3247 | PhysicsActor pa = m_rootPart.PhysActor; |
3203 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | 3248 | |
3249 | if (pa != null) | ||
3250 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); | ||
3204 | } | 3251 | } |
3205 | } | 3252 | } |
3206 | 3253 | ||
@@ -3218,7 +3265,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3218 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 3265 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); |
3219 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | 3266 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); |
3220 | 3267 | ||
3221 | if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) | 3268 | PhysicsActor pa = m_rootPart.PhysActor; |
3269 | |||
3270 | if (pa != null && pa.IsPhysical) | ||
3222 | { | 3271 | { |
3223 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); | 3272 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); |
3224 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); | 3273 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); |
@@ -3243,7 +3292,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3243 | float f = 1.0f; | 3292 | float f = 1.0f; |
3244 | float a = 1.0f; | 3293 | float a = 1.0f; |
3245 | 3294 | ||
3246 | if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) | 3295 | if (pa != null && pa.IsPhysical) |
3247 | { | 3296 | { |
3248 | if (oldSize.X * x > m_scene.m_maxPhys) | 3297 | if (oldSize.X * x > m_scene.m_maxPhys) |
3249 | { | 3298 | { |
@@ -3558,13 +3607,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3558 | // needs to be called with phys building true | 3607 | // needs to be called with phys building true |
3559 | Quaternion axRot = rot; | 3608 | Quaternion axRot = rot; |
3560 | Quaternion oldParentRot = m_rootPart.RotationOffset; | 3609 | Quaternion oldParentRot = m_rootPart.RotationOffset; |
3561 | 3610 | ||
3611 | m_rootPart.StoreUndoState(); | ||
3562 | //Don't use UpdateRotation because it schedules an update prematurely | 3612 | //Don't use UpdateRotation because it schedules an update prematurely |
3563 | m_rootPart.RotationOffset = rot; | 3613 | m_rootPart.RotationOffset = rot; |
3564 | if (m_rootPart.PhysActor != null) | 3614 | |
3615 | PhysicsActor pa = m_rootPart.PhysActor; | ||
3616 | |||
3617 | if (pa != null) | ||
3565 | { | 3618 | { |
3566 | m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; | 3619 | pa.Orientation = m_rootPart.RotationOffset; |
3567 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 3620 | m_scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3568 | } | 3621 | } |
3569 | 3622 | ||
3570 | SceneObjectPart[] parts = m_parts.GetArray(); | 3623 | SceneObjectPart[] parts = m_parts.GetArray(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cfa3cd4..83b0b18 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -152,6 +152,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
152 | public int[] PayPrice = {-2,-2,-2,-2,-2}; | 152 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
153 | 153 | ||
154 | [XmlIgnore] | 154 | [XmlIgnore] |
155 | /// <summary> | ||
156 | /// The representation of this part in the physics scene. | ||
157 | /// </summary> | ||
158 | /// <remarks> | ||
159 | /// If you use this property more than once in a section of code then you must take a reference and use that. | ||
160 | /// If another thread is simultaneously turning physics off on this part then this refernece could become | ||
161 | /// null at any time. | ||
162 | /// </remarks> | ||
155 | public PhysicsActor PhysActor | 163 | public PhysicsActor PhysActor |
156 | { | 164 | { |
157 | get { return m_physActor; } | 165 | get { return m_physActor; } |
@@ -555,10 +563,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
555 | set | 563 | set |
556 | { | 564 | { |
557 | m_name = value; | 565 | m_name = value; |
558 | if (PhysActor != null) | 566 | |
559 | { | 567 | PhysicsActor pa = PhysActor; |
560 | PhysActor.SOPName = value; | 568 | |
561 | } | 569 | if (pa != null) |
570 | pa.SOPName = value; | ||
571 | } | ||
572 | } | ||
573 | |||
574 | public byte Material | ||
575 | { | ||
576 | get { return (byte) m_material; } | ||
577 | set | ||
578 | { | ||
579 | m_material = (Material)value; | ||
580 | |||
581 | PhysicsActor pa = PhysActor; | ||
582 | |||
583 | if (pa != null) | ||
584 | pa.SetMaterial((int)value); | ||
562 | } | 585 | } |
563 | } | 586 | } |
564 | 587 | ||
@@ -1017,7 +1040,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1017 | if (Shape.SculptEntry) | 1040 | if (Shape.SculptEntry) |
1018 | CheckSculptAndLoad(); | 1041 | CheckSculptAndLoad(); |
1019 | else | 1042 | else |
1020 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 1043 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
1021 | } | 1044 | } |
1022 | } | 1045 | } |
1023 | } | 1046 | } |
@@ -1868,33 +1891,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
1868 | } | 1891 | } |
1869 | 1892 | ||
1870 | // Basic Physics can also return null as well as an exception catch. | 1893 | // Basic Physics can also return null as well as an exception catch. |
1871 | if (PhysActor != null) | 1894 | PhysicsActor pa = PhysActor; |
1895 | |||
1896 | if (pa != null) | ||
1872 | { | 1897 | { |
1873 | PhysActor.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info | 1898 | pa.SOPName = this.Name; // save object into the PhysActor so ODE internals know the joint/body info |
1874 | PhysActor.SetMaterial(Material); | 1899 | pa.SetMaterial(Material); |
1875 | 1900 | ||
1876 | // if root part apply vehicle | 1901 | // if root part apply vehicle |
1877 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) | 1902 | if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) |
1878 | m_vehicle.SetVehicle(PhysActor); | 1903 | m_vehicle.SetVehicle(pa); |
1879 | 1904 | ||
1880 | DoPhysicsPropertyUpdate(isPhysical, true); | 1905 | DoPhysicsPropertyUpdate(isPhysical, true); |
1881 | if(VolumeDetectActive) // change if not the default only | 1906 | if(VolumeDetectActive) // change if not the default only |
1882 | PhysActor.SetVolumeDetect(1); | 1907 | pa.SetVolumeDetect(1); |
1883 | 1908 | ||
1884 | if (!building) | 1909 | if (!building) |
1885 | PhysActor.Building = false; | 1910 | pa.Building = false; |
1886 | 1911 | ||
1887 | Velocity = velocity; | 1912 | Velocity = velocity; |
1888 | AngularVelocity = rotationalVelocity; | 1913 | AngularVelocity = rotationalVelocity; |
1889 | PhysActor.Velocity = velocity; | 1914 | pa.Velocity = velocity; |
1890 | PhysActor.RotationalVelocity = rotationalVelocity; | 1915 | pa.RotationalVelocity = rotationalVelocity; |
1891 | 1916 | ||
1892 | // if not vehicle and root part apply force and torque | 1917 | // if not vehicle and root part apply force and torque |
1893 | if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) | 1918 | if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) |
1894 | && LocalId == ParentGroup.RootPart.LocalId) | 1919 | && LocalId == ParentGroup.RootPart.LocalId) |
1895 | { | 1920 | { |
1896 | PhysActor.Force = Force; | 1921 | pa.Force = Force; |
1897 | PhysActor.Torque = Torque; | 1922 | pa.Torque = Torque; |
1898 | } | 1923 | } |
1899 | } | 1924 | } |
1900 | } | 1925 | } |
@@ -2125,11 +2150,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2125 | } | 2150 | } |
2126 | else | 2151 | else |
2127 | { | 2152 | { |
2128 | if (PhysActor != null) | 2153 | PhysicsActor pa = PhysActor; |
2154 | |||
2155 | if (pa != null) | ||
2129 | { | 2156 | { |
2130 | if (UsePhysics != PhysActor.IsPhysical || isNew) | 2157 | if (UsePhysics != pa.IsPhysical || isNew) |
2131 | { | 2158 | { |
2132 | if (PhysActor.IsPhysical) | 2159 | if (pa.IsPhysical) // implies UsePhysics==false for this block |
2133 | { | 2160 | { |
2134 | if (!isNew) // implies UsePhysics==false for this block | 2161 | if (!isNew) // implies UsePhysics==false for this block |
2135 | { | 2162 | { |
@@ -2173,9 +2200,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2173 | 2200 | ||
2174 | if (ParentID != 0 && ParentID != LocalId) | 2201 | if (ParentID != 0 && ParentID != LocalId) |
2175 | { | 2202 | { |
2176 | if (ParentGroup.RootPart.PhysActor != null) | 2203 | ParentGroup.Scene.AddPhysicalPrim(1); |
2204 | |||
2205 | pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | ||
2206 | pa.OnOutOfBounds += PhysicsOutOfBounds; | ||
2207 | if (ParentID != 0 && ParentID != LocalId) | ||
2177 | { | 2208 | { |
2178 | PhysActor.link(ParentGroup.RootPart.PhysActor); | 2209 | PhysicsActor parentPa = ParentGroup.RootPart.PhysActor; |
2210 | |||
2211 | if (parentPa != null) | ||
2212 | { | ||
2213 | pa.link(parentPa); | ||
2214 | } | ||
2179 | } | 2215 | } |
2180 | } | 2216 | } |
2181 | } | 2217 | } |
@@ -2191,7 +2227,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2191 | if (Shape.SculptEntry) | 2227 | if (Shape.SculptEntry) |
2192 | CheckSculptAndLoad(); | 2228 | CheckSculptAndLoad(); |
2193 | else | 2229 | else |
2194 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 2230 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2195 | } | 2231 | } |
2196 | } | 2232 | } |
2197 | } | 2233 | } |
@@ -2302,23 +2338,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2302 | 2338 | ||
2303 | public Vector3 GetGeometricCenter() | 2339 | public Vector3 GetGeometricCenter() |
2304 | { | 2340 | { |
2305 | if (PhysActor != null) | 2341 | PhysicsActor pa = PhysActor; |
2306 | return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); | 2342 | |
2343 | if (pa != null) | ||
2344 | return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); | ||
2307 | else | 2345 | else |
2308 | return new Vector3(0, 0, 0); | 2346 | return new Vector3(0, 0, 0); |
2309 | } | 2347 | } |
2310 | 2348 | ||
2311 | public float GetMass() | 2349 | public float GetMass() |
2312 | { | 2350 | { |
2313 | if (PhysActor != null) | 2351 | PhysicsActor pa = PhysActor; |
2314 | return PhysActor.Mass; | 2352 | |
2353 | if (pa != null) | ||
2354 | return pa.Mass; | ||
2315 | else | 2355 | else |
2316 | return 0; | 2356 | return 0; |
2317 | } | 2357 | } |
2318 | 2358 | ||
2319 | public Vector3 GetForce() | 2359 | public Vector3 GetForce() |
2320 | { | 2360 | { |
2321 | return Force; | 2361 | return Force; |
2322 | } | 2362 | } |
2323 | 2363 | ||
2324 | /// <summary> | 2364 | /// <summary> |
@@ -2947,9 +2987,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2947 | 2987 | ||
2948 | public void PhysicsRequestingTerseUpdate() | 2988 | public void PhysicsRequestingTerseUpdate() |
2949 | { | 2989 | { |
2950 | if (PhysActor != null) | 2990 | PhysicsActor pa = PhysActor; |
2991 | |||
2992 | if (pa != null) | ||
2951 | { | 2993 | { |
2952 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); | 2994 | Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); |
2953 | 2995 | ||
2954 | if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | 2996 | if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) |
2955 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | 2997 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) |
@@ -2961,6 +3003,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2961 | } | 3003 | } |
2962 | //ParentGroup.RootPart.m_groupPosition = newpos; | 3004 | //ParentGroup.RootPart.m_groupPosition = newpos; |
2963 | } | 3005 | } |
3006 | |||
2964 | ScheduleTerseUpdate(); | 3007 | ScheduleTerseUpdate(); |
2965 | } | 3008 | } |
2966 | 3009 | ||
@@ -3052,7 +3095,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3052 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); | 3095 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); |
3053 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); | 3096 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); |
3054 | 3097 | ||
3055 | if (PhysActor != null && PhysActor.IsPhysical) | 3098 | PhysicsActor pa = PhysActor; |
3099 | |||
3100 | if (pa != null && pa.IsPhysical) | ||
3056 | { | 3101 | { |
3057 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); | 3102 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); |
3058 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); | 3103 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); |
@@ -3214,12 +3259,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3214 | m_shape.SculptData = texture.Data; | 3259 | m_shape.SculptData = texture.Data; |
3215 | } | 3260 | } |
3216 | 3261 | ||
3217 | if (PhysActor != null) | 3262 | PhysicsActor pa = PhysActor; |
3263 | |||
3264 | if (pa != null) | ||
3218 | { | 3265 | { |
3219 | // Update the physics actor with the new loaded sculpt data and set the taint signal. | 3266 | // Update the physics actor with the new loaded sculpt data and set the taint signal. |
3220 | PhysActor.Shape = m_shape; | 3267 | pa.Shape = m_shape; |
3221 | 3268 | ||
3222 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 3269 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3223 | } | 3270 | } |
3224 | } | 3271 | } |
3225 | } | 3272 | } |
@@ -3495,17 +3542,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3495 | 3542 | ||
3496 | public void SetFloatOnWater(int floatYN) | 3543 | public void SetFloatOnWater(int floatYN) |
3497 | { | 3544 | { |
3498 | if (PhysActor != null) | 3545 | PhysicsActor pa = PhysActor; |
3499 | { | 3546 | |
3500 | if (floatYN == 1) | 3547 | if (pa != null) |
3501 | { | 3548 | pa.FloatOnWater = floatYN == 1; |
3502 | PhysActor.FloatOnWater = true; | ||
3503 | } | ||
3504 | else | ||
3505 | { | ||
3506 | PhysActor.FloatOnWater = false; | ||
3507 | } | ||
3508 | } | ||
3509 | } | 3549 | } |
3510 | 3550 | ||
3511 | public void SetForce(Vector3 force) | 3551 | public void SetForce(Vector3 force) |
@@ -4800,7 +4840,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4800 | // Defensive programming calls for a check here. | 4840 | // Defensive programming calls for a check here. |
4801 | // Better would be throwing an exception that could be catched by a unit test as the internal | 4841 | // Better would be throwing an exception that could be catched by a unit test as the internal |
4802 | // logic should make sure, this Physactor is always here. | 4842 | // logic should make sure, this Physactor is always here. |
4803 | if (this.PhysActor != null) | 4843 | if (pa != null) |
4804 | { | 4844 | { |
4805 | PhysActor.SetVolumeDetect(1); | 4845 | PhysActor.SetVolumeDetect(1); |
4806 | // AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active | 4846 | // AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active |
@@ -4814,7 +4854,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4814 | if (this.PhysActor != null) | 4854 | if (this.PhysActor != null) |
4815 | { | 4855 | { |
4816 | PhysActor.SetVolumeDetect(0); | 4856 | PhysActor.SetVolumeDetect(0); |
4817 | } | ||
4818 | 4857 | ||
4819 | this.VolumeDetectActive = false; | 4858 | this.VolumeDetectActive = false; |
4820 | } | 4859 | } |
@@ -4827,6 +4866,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4827 | { | 4866 | { |
4828 | RemFlag(PrimFlags.TemporaryOnRez); | 4867 | RemFlag(PrimFlags.TemporaryOnRez); |
4829 | } | 4868 | } |
4869 | |||
4830 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 4870 | // m_log.Debug("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
4831 | 4871 | ||
4832 | // and last in case we have a new actor and not building | 4872 | // and last in case we have a new actor and not building |
@@ -4898,10 +4938,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4898 | m_shape.PathTwist = shapeBlock.PathTwist; | 4938 | m_shape.PathTwist = shapeBlock.PathTwist; |
4899 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; | 4939 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; |
4900 | 4940 | ||
4901 | if (PhysActor != null) | 4941 | PhysicsActor pa = PhysActor; |
4942 | |||
4943 | if (pa != null) | ||
4902 | { | 4944 | { |
4903 | PhysActor.Shape = m_shape; | 4945 | pa.Shape = m_shape; |
4904 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 4946 | ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
4905 | } | 4947 | } |
4906 | 4948 | ||
4907 | // This is what makes vehicle trailers work | 4949 | // This is what makes vehicle trailers work |
@@ -5043,6 +5085,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5043 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; | 5085 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; |
5044 | } | 5086 | } |
5045 | 5087 | ||
5088 | PhysicsActor pa = PhysActor; | ||
5089 | |||
5046 | if ( | 5090 | if ( |
5047 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || | 5091 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || |
5048 | ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || | 5092 | ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || |
@@ -5054,18 +5098,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5054 | ) | 5098 | ) |
5055 | { | 5099 | { |
5056 | // subscribe to physics updates. | 5100 | // subscribe to physics updates. |
5057 | if (PhysActor != null) | 5101 | if (pa != null) |
5058 | { | 5102 | { |
5059 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 5103 | pa.OnCollisionUpdate += PhysicsCollision; |
5060 | PhysActor.SubscribeEvents(1000); | 5104 | pa.SubscribeEvents(1000); |
5061 | } | 5105 | } |
5062 | } | 5106 | } |
5063 | else | 5107 | else |
5064 | { | 5108 | { |
5065 | if (PhysActor != null) | 5109 | if (pa != null) |
5066 | { | 5110 | { |
5067 | PhysActor.UnSubscribeEvents(); | 5111 | pa.UnSubscribeEvents(); |
5068 | PhysActor.OnCollisionUpdate -= PhysicsCollision; | 5112 | pa.OnCollisionUpdate -= PhysicsCollision; |
5069 | } | 5113 | } |
5070 | } | 5114 | } |
5071 | 5115 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ce05b8c..5268ade 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1474,7 +1474,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1474 | if (scale.z < 0.01) | 1474 | if (scale.z < 0.01) |
1475 | scale.z = 0.01; | 1475 | scale.z = 0.01; |
1476 | 1476 | ||
1477 | if (part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical) | 1477 | PhysicsActor pa = part.ParentGroup.RootPart.PhysActor; |
1478 | |||
1479 | if (pa != null && pa.IsPhysical) | ||
1478 | { | 1480 | { |
1479 | if (scale.x > World.m_maxPhys) | 1481 | if (scale.x > World.m_maxPhys) |
1480 | scale.x = World.m_maxPhys; | 1482 | scale.x = World.m_maxPhys; |
@@ -2345,7 +2347,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2345 | // but only if the object is not physial and active. This is important for rotating doors. | 2347 | // but only if the object is not physial and active. This is important for rotating doors. |
2346 | // without the absoluteposition = absoluteposition happening, the doors do not move in the physics | 2348 | // without the absoluteposition = absoluteposition happening, the doors do not move in the physics |
2347 | // scene | 2349 | // scene |
2348 | if (part.PhysActor != null && !part.PhysActor.IsPhysical) | 2350 | PhysicsActor pa = part.PhysActor; |
2351 | |||
2352 | if (pa != null && !pa.IsPhysical) | ||
2349 | { | 2353 | { |
2350 | part.ParentGroup.ResetChildPrimPhysicsPositions(); | 2354 | part.ParentGroup.ResetChildPrimPhysicsPositions(); |
2351 | } | 2355 | } |
@@ -3073,7 +3077,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3073 | 3077 | ||
3074 | float groupmass = new_group.GetMass(); | 3078 | float groupmass = new_group.GetMass(); |
3075 | 3079 | ||
3076 | if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) | 3080 | PhysicsActor pa = new_group.RootPart.PhysActor; |
3081 | |||
3082 | if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) | ||
3077 | { | 3083 | { |
3078 | //Recoil. | 3084 | //Recoil. |
3079 | llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); | 3085 | llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); |
@@ -3510,6 +3516,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3510 | public void llSetHoverHeight(double height, int water, double tau) | 3516 | public void llSetHoverHeight(double height, int water, double tau) |
3511 | { | 3517 | { |
3512 | m_host.AddScriptLPS(1); | 3518 | m_host.AddScriptLPS(1); |
3519 | |||
3513 | if (m_host.PhysActor != null) | 3520 | if (m_host.PhysActor != null) |
3514 | { | 3521 | { |
3515 | PIDHoverType hoverType = PIDHoverType.Ground; | 3522 | PIDHoverType hoverType = PIDHoverType.Ground; |
@@ -3560,7 +3567,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3560 | 3567 | ||
3561 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply | 3568 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply |
3562 | // set the rotation of the object, copy that behavior | 3569 | // set the rotation of the object, copy that behavior |
3563 | if (strength == 0 || m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) | 3570 | PhysicsActor pa = m_host.PhysActor; |
3571 | |||
3572 | if (strength == 0 || pa == null || !pa.IsPhysical) | ||
3564 | { | 3573 | { |
3565 | llSetLocalRot(target); | 3574 | llSetLocalRot(target); |
3566 | } | 3575 | } |