diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rwxr-xr-x | OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | 73 |
1 files changed, 70 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index decb61a..278e9e7 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -291,6 +291,10 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
291 | return ret; | 291 | return ret; |
292 | } | 292 | } |
293 | 293 | ||
294 | // physChangeLinkFixed(integer linkNum) | ||
295 | // Change the link between the root and the linkNum into a fixed, static physical connection. | ||
296 | // This needs to change 'linkNum' into the physical object because lower level code has | ||
297 | // no access to the link numbers. | ||
294 | [ScriptInvocation] | 298 | [ScriptInvocation] |
295 | public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) | 299 | public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) |
296 | { | 300 | { |
@@ -353,13 +357,76 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
353 | [ScriptInvocation] | 357 | [ScriptInvocation] |
354 | public int physChangeLinkHinge(UUID hostID, UUID scriptID, int linkNum) | 358 | public int physChangeLinkHinge(UUID hostID, UUID scriptID, int linkNum) |
355 | { | 359 | { |
356 | return 0; | 360 | return -1; |
357 | } | 361 | } |
358 | 362 | ||
359 | [ScriptInvocation] | 363 | [ScriptInvocation] |
360 | public int physChangeLinkSpring(UUID hostID, UUID scriptID, int linkNum) | 364 | public int physChangeLinkSpring(UUID hostID, UUID scriptID, int linkNum, |
365 | Vector3 frameInAloc, Quaternion frameInArot, | ||
366 | Vector3 frameInBloc, Quaternion frameInBrot, | ||
367 | Vector3 linearLimitLow, Vector3 linearLimitHigh, | ||
368 | Vector3 angularLimitLow, Vector3 angularLimitHigh | ||
369 | ) | ||
361 | { | 370 | { |
362 | return 0; | 371 | int ret = -1; |
372 | if (!Enabled) return ret; | ||
373 | |||
374 | // The part that is requesting the change. | ||
375 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); | ||
376 | |||
377 | if (requestingPart != null) | ||
378 | { | ||
379 | // The type is is always on the root of a linkset. | ||
380 | SceneObjectGroup containingGroup = requestingPart.ParentGroup; | ||
381 | SceneObjectPart rootPart = containingGroup.RootPart; | ||
382 | |||
383 | if (rootPart != null) | ||
384 | { | ||
385 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | ||
386 | if (rootPhysActor != null) | ||
387 | { | ||
388 | SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum); | ||
389 | if (linkPart != null) | ||
390 | { | ||
391 | Physics.Manager.PhysicsActor linkPhysActor = linkPart.PhysActor; | ||
392 | if (linkPhysActor != null) | ||
393 | { | ||
394 | ret = (int)rootPhysActor.Extension(PhysFunctChangeLinkSpring, linkNum, linkPhysActor, | ||
395 | frameInAloc, frameInArot, | ||
396 | frameInBloc, frameInBrot, | ||
397 | linearLimitLow, linearLimitHigh, | ||
398 | angularLimitLow, angularLimitHigh | ||
399 | ); | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | m_log.WarnFormat("{0} physChangeLinkFixed: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}", | ||
404 | LogHeader, rootPart.Name, hostID, linkNum); | ||
405 | } | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | m_log.WarnFormat("{0} physChangeLinkFixed: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}", | ||
410 | LogHeader, rootPart.Name, hostID, linkNum); | ||
411 | } | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not have a physics actor. rootName={1}, hostID={2}", | ||
416 | LogHeader, rootPart.Name, hostID); | ||
417 | } | ||
418 | } | ||
419 | else | ||
420 | { | ||
421 | m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not exist. RequestingPartName={1}, hostID={2}", | ||
422 | LogHeader, requestingPart.Name, hostID); | ||
423 | } | ||
424 | } | ||
425 | else | ||
426 | { | ||
427 | m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); | ||
428 | } | ||
429 | return ret; | ||
363 | } | 430 | } |
364 | 431 | ||
365 | [ScriptInvocation] | 432 | [ScriptInvocation] |