diff options
author | Robert Adams | 2013-08-07 11:13:53 -0700 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-09-20 21:02:12 +0100 |
commit | 3ffad76b0da68733474fc5a525060cba46693c63 (patch) | |
tree | eab7352ae33b4281bab352db3faaa62a2b15f4bf /OpenSim/Region/OptionalModules/Scripting | |
parent | BulletSim: move linkset extension operations into BSPrimLinkable where they s... (diff) | |
download | opensim-SC_OLD-3ffad76b0da68733474fc5a525060cba46693c63.zip opensim-SC_OLD-3ffad76b0da68733474fc5a525060cba46693c63.tar.gz opensim-SC_OLD-3ffad76b0da68733474fc5a525060cba46693c63.tar.bz2 opensim-SC_OLD-3ffad76b0da68733474fc5a525060cba46693c63.tar.xz |
BulletSim: initial implementation of physChangeLinkFixed that resets a linkset's link back to a fixed, non-moving connection.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rwxr-xr-x | OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index 4455df4..decb61a 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -61,6 +61,10 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
61 | // Per prim functions. See BSPrim. | 61 | // Per prim functions. See BSPrim. |
62 | public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; | 62 | public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; |
63 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; | 63 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; |
64 | public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed"; | ||
65 | public const string PhysFunctChangeLinkHinge = "BulletSim.ChangeLinkHinge"; | ||
66 | public const string PhysFunctChangeLinkSpring = "BulletSim.ChangeLinkSpring"; | ||
67 | public const string PhysFunctChangeLinkSlider = "BulletSim.ChangeLinkSlider"; | ||
64 | 68 | ||
65 | // ============================================================= | 69 | // ============================================================= |
66 | 70 | ||
@@ -250,7 +254,6 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
250 | public int physGetLinksetType(UUID hostID, UUID scriptID) | 254 | public int physGetLinksetType(UUID hostID, UUID scriptID) |
251 | { | 255 | { |
252 | int ret = -1; | 256 | int ret = -1; |
253 | |||
254 | if (!Enabled) return ret; | 257 | if (!Enabled) return ret; |
255 | 258 | ||
256 | // The part that is requesting the change. | 259 | // The part that is requesting the change. |
@@ -287,5 +290,82 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
287 | } | 290 | } |
288 | return ret; | 291 | return ret; |
289 | } | 292 | } |
293 | |||
294 | [ScriptInvocation] | ||
295 | public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) | ||
296 | { | ||
297 | int ret = -1; | ||
298 | if (!Enabled) return ret; | ||
299 | |||
300 | // The part that is requesting the change. | ||
301 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); | ||
302 | |||
303 | if (requestingPart != null) | ||
304 | { | ||
305 | // The type is is always on the root of a linkset. | ||
306 | SceneObjectGroup containingGroup = requestingPart.ParentGroup; | ||
307 | SceneObjectPart rootPart = containingGroup.RootPart; | ||
308 | |||
309 | if (rootPart != null) | ||
310 | { | ||
311 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | ||
312 | if (rootPhysActor != null) | ||
313 | { | ||
314 | SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum); | ||
315 | if (linkPart != null) | ||
316 | { | ||
317 | Physics.Manager.PhysicsActor linkPhysActor = linkPart.PhysActor; | ||
318 | if (linkPhysActor != null) | ||
319 | { | ||
320 | ret = (int)rootPhysActor.Extension(PhysFunctChangeLinkFixed, linkNum, linkPhysActor); | ||
321 | } | ||
322 | else | ||
323 | { | ||
324 | m_log.WarnFormat("{0} physChangeLinkFixed: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}", | ||
325 | LogHeader, rootPart.Name, hostID, linkNum); | ||
326 | } | ||
327 | } | ||
328 | else | ||
329 | { | ||
330 | m_log.WarnFormat("{0} physChangeLinkFixed: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}", | ||
331 | LogHeader, rootPart.Name, hostID, linkNum); | ||
332 | } | ||
333 | } | ||
334 | else | ||
335 | { | ||
336 | m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not have a physics actor. rootName={1}, hostID={2}", | ||
337 | LogHeader, rootPart.Name, hostID); | ||
338 | } | ||
339 | } | ||
340 | else | ||
341 | { | ||
342 | m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not exist. RequestingPartName={1}, hostID={2}", | ||
343 | LogHeader, requestingPart.Name, hostID); | ||
344 | } | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); | ||
349 | } | ||
350 | return ret; | ||
351 | } | ||
352 | |||
353 | [ScriptInvocation] | ||
354 | public int physChangeLinkHinge(UUID hostID, UUID scriptID, int linkNum) | ||
355 | { | ||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | [ScriptInvocation] | ||
360 | public int physChangeLinkSpring(UUID hostID, UUID scriptID, int linkNum) | ||
361 | { | ||
362 | return 0; | ||
363 | } | ||
364 | |||
365 | [ScriptInvocation] | ||
366 | public int physChangeLinkSlider(UUID hostID, UUID scriptID, int linkNum) | ||
367 | { | ||
368 | return 0; | ||
369 | } | ||
290 | } | 370 | } |
291 | } | 371 | } |