diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs')
-rwxr-xr-x | OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index d1d318c..4455df4 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Linq; | 29 | using System.Linq; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | ||
32 | 33 | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.CoreModules; | 35 | using OpenSim.Region.CoreModules; |
@@ -198,7 +199,33 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
198 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | 199 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; |
199 | if (rootPhysActor != null) | 200 | if (rootPhysActor != null) |
200 | { | 201 | { |
201 | ret = (int)rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); | 202 | if (rootPhysActor.IsPhysical) |
203 | { | ||
204 | // Change a physical linkset by making non-physical, waiting for one heartbeat so all | ||
205 | // the prim and linkset state is updated, changing the type and making the | ||
206 | // linkset physical again. | ||
207 | containingGroup.ScriptSetPhysicsStatus(false); | ||
208 | Thread.Sleep(150); // longer than one heartbeat tick | ||
209 | |||
210 | // A kludge for the moment. | ||
211 | // Since compound linksets move the children but don't generate position updates to the | ||
212 | // simulator, it is possible for compound linkset children to have out-of-sync simulator | ||
213 | // and physical positions. The following causes the simulator to push the real child positions | ||
214 | // down into the physics engine to get everything synced. | ||
215 | containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); | ||
216 | containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); | ||
217 | |||
218 | ret = (int)rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); | ||
219 | Thread.Sleep(150); // longer than one heartbeat tick | ||
220 | |||
221 | containingGroup.ScriptSetPhysicsStatus(true); | ||
222 | } | ||
223 | else | ||
224 | { | ||
225 | // Non-physical linksets don't have a physical instantiation so there is no state to | ||
226 | // worry about being updated. | ||
227 | ret = (int)rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); | ||
228 | } | ||
202 | } | 229 | } |
203 | else | 230 | else |
204 | { | 231 | { |