diff options
author | Robert Adams | 2013-08-06 10:32:56 -0700 |
---|---|---|
committer | Robert Adams | 2013-09-11 09:11:34 -0700 |
commit | 725751fd6c0101b8610e84716d28b6af91e20b61 (patch) | |
tree | c43b6528c292e5991d4cf44741cf9702b3ab75e5 /OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |
parent | chaning the default max_distance to 16383 as we actually start counting at ze... (diff) | |
download | opensim-SC_OLD-725751fd6c0101b8610e84716d28b6af91e20b61.zip opensim-SC_OLD-725751fd6c0101b8610e84716d28b6af91e20b61.tar.gz opensim-SC_OLD-725751fd6c0101b8610e84716d28b6af91e20b61.tar.bz2 opensim-SC_OLD-725751fd6c0101b8610e84716d28b6af91e20b61.tar.xz |
BulletSim: fixes for change linkset implementation of physical linksets.
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 | { |