diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index fabf276..cc99929 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1466,6 +1466,64 @@ namespace OpenSim.Region.Environment.Scenes | |||
1466 | } | 1466 | } |
1467 | } | 1467 | } |
1468 | 1468 | ||
1469 | public void applyAngularImpulse(PhysicsVector impulse) | ||
1470 | { | ||
1471 | // We check if rootpart is null here because scripts don't delete if you delete the host. | ||
1472 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1473 | // Make sure we don't do that! | ||
1474 | SceneObjectPart rootpart = m_rootPart; | ||
1475 | if (rootpart != null) | ||
1476 | { | ||
1477 | if (rootpart.PhysActor != null) | ||
1478 | { | ||
1479 | if (!IsAttachment) | ||
1480 | { | ||
1481 | rootpart.PhysActor.AddAngularForce(impulse, true); | ||
1482 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | ||
1483 | } | ||
1484 | } | ||
1485 | } | ||
1486 | } | ||
1487 | |||
1488 | public void setAngularImpulse(PhysicsVector impulse) | ||
1489 | { | ||
1490 | // We check if rootpart is null here because scripts don't delete if you delete the host. | ||
1491 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1492 | // Make sure we don't do that! | ||
1493 | SceneObjectPart rootpart = m_rootPart; | ||
1494 | if (rootpart != null) | ||
1495 | { | ||
1496 | if (rootpart.PhysActor != null) | ||
1497 | { | ||
1498 | if (!IsAttachment) | ||
1499 | { | ||
1500 | rootpart.PhysActor.Torque = impulse; | ||
1501 | m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor); | ||
1502 | } | ||
1503 | } | ||
1504 | } | ||
1505 | } | ||
1506 | |||
1507 | public Vector3 GetTorque() | ||
1508 | { | ||
1509 | // We check if rootpart is null here because scripts don't delete if you delete the host. | ||
1510 | // This means that unfortunately, we can pass a null physics actor to Simulate! | ||
1511 | // Make sure we don't do that! | ||
1512 | SceneObjectPart rootpart = m_rootPart; | ||
1513 | if (rootpart != null) | ||
1514 | { | ||
1515 | if (rootpart.PhysActor != null) | ||
1516 | { | ||
1517 | if (!IsAttachment) | ||
1518 | { | ||
1519 | PhysicsVector torque = rootpart.PhysActor.Torque; | ||
1520 | return new Vector3(torque.X, torque.Y, torque.Z); | ||
1521 | } | ||
1522 | } | ||
1523 | } | ||
1524 | return Vector3.Zero; | ||
1525 | } | ||
1526 | |||
1469 | public void moveToTarget(Vector3 target, float tau) | 1527 | public void moveToTarget(Vector3 target, float tau) |
1470 | { | 1528 | { |
1471 | SceneObjectPart rootpart = m_rootPart; | 1529 | SceneObjectPart rootpart = m_rootPart; |