diff options
author | Teravus Ovares | 2008-02-12 00:01:55 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-12 00:01:55 +0000 |
commit | c92696286215ca8260fa80472e2678d0482553b7 (patch) | |
tree | 22dd421b8e2144922b91b69ff3cfa9ef923f7592 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |
parent | * Added PhysicsScene.Dispose() (diff) | |
download | opensim-SC-c92696286215ca8260fa80472e2678d0482553b7.zip opensim-SC-c92696286215ca8260fa80472e2678d0482553b7.tar.gz opensim-SC-c92696286215ca8260fa80472e2678d0482553b7.tar.bz2 opensim-SC-c92696286215ca8260fa80472e2678d0482553b7.tar.xz |
* This resolves the null exceptions when a script is manipulating a physical object in ODE and you delete the object. The script is still running and trying to add force, but the object reference is null.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index c94a57d..a745d9c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -580,11 +580,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
580 | 580 | ||
581 | public void applyImpulse(PhysicsVector impulse) | 581 | public void applyImpulse(PhysicsVector impulse) |
582 | { | 582 | { |
583 | // We check if rootpart is null here because scripts don't delete if you delete the host. | ||
584 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
585 | // Make sure we don't do that! | ||
583 | SceneObjectPart rootpart = m_rootPart; | 586 | SceneObjectPart rootpart = m_rootPart; |
584 | if (m_rootPart.PhysActor != null) | 587 | if (rootpart != null) |
585 | { | 588 | { |
586 | m_rootPart.PhysActor.AddForce(impulse); | 589 | if (rootpart.PhysActor != null) |
587 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 590 | { |
591 | rootpart.PhysActor.AddForce(impulse); | ||
592 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | ||
593 | } | ||
588 | } | 594 | } |
589 | } | 595 | } |
590 | 596 | ||