diff options
author | Teravus Ovares | 2008-01-17 14:59:05 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-17 14:59:05 +0000 |
commit | 18c959df12983256d73240a86fa0bad12c4e36ce (patch) | |
tree | d85ef34d3196461f8d3dd0ae653b37912f098a7e /OpenSim/Region/Environment | |
parent | * added ForEachPart helper (diff) | |
download | opensim-SC_OLD-18c959df12983256d73240a86fa0bad12c4e36ce.zip opensim-SC_OLD-18c959df12983256d73240a86fa0bad12c4e36ce.tar.gz opensim-SC_OLD-18c959df12983256d73240a86fa0bad12c4e36ce.tar.bz2 opensim-SC_OLD-18c959df12983256d73240a86fa0bad12c4e36ce.tar.xz |
* Added llApplyImpulse in the global frame. The object must be physical before this'll do anything. Be careful with this function as it's easy to loose prim.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 6447403..5790591 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -578,6 +578,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
578 | SetPartAsRoot(newPart); | 578 | SetPartAsRoot(newPart); |
579 | } | 579 | } |
580 | 580 | ||
581 | public void applyImpulse(PhysicsVector impulse) | ||
582 | { | ||
583 | SceneObjectPart rootpart = m_rootPart; | ||
584 | if (m_rootPart.PhysActor != null) | ||
585 | { | ||
586 | m_rootPart.PhysActor.AddForce(impulse); | ||
587 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | ||
588 | } | ||
589 | } | ||
590 | |||
581 | public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) | 591 | public void SetRootPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) |
582 | { | 592 | { |
583 | part.LastOwnerID = part.OwnerID; | 593 | part.LastOwnerID = part.OwnerID; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 0cb4ae7..ce38bee 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -520,6 +520,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
520 | 520 | ||
521 | protected PrimitiveBaseShape m_shape; | 521 | protected PrimitiveBaseShape m_shape; |
522 | 522 | ||
523 | /// <summary> | ||
524 | /// hook to the physics scene to apply impulse | ||
525 | /// This is sent up to the group, which then finds the root prim | ||
526 | /// and applies the force on the root prim of the group | ||
527 | /// </summary> | ||
528 | /// <param name="impulse">Vector force</param> | ||
529 | public void ApplyImpulse(LLVector3 impulsei) | ||
530 | { | ||
531 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); | ||
532 | if (m_parentGroup != null) | ||
533 | { | ||
534 | m_parentGroup.applyImpulse(impulse); | ||
535 | } | ||
536 | } | ||
537 | |||
523 | public void TriggerScriptChangedEvent(Changed val) | 538 | public void TriggerScriptChangedEvent(Changed val) |
524 | { | 539 | { |
525 | if (m_parentGroup != null) | 540 | if (m_parentGroup != null) |