aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-12-14 14:30:28 +0000
committerTeravus Ovares2008-12-14 14:30:28 +0000
commit8ad6f575ebc23f0c7b282b9ec2543bce26287e54 (patch)
treeab424abb19a070cce386a5013b3d5452dbdf9bc2 /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
parentAdded ATTACH_HUD_* constants fixes Mantis #2823 (diff)
downloadopensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.zip
opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.tar.gz
opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.tar.bz2
opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.tar.xz
* Implements the torque/Rotational Impulse methods in the PhysicsAPI and the ODEPlugin and pipes them to their respective LSL method.
* NBody will need to be updated, this is an API change. Torque property and AddAngularForce
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs58
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;