From f74a9bcdc7b0682c1c205e9d640fbfa5f214840b Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Thu, 24 Jul 2008 07:45:58 +0000 Subject: Implements llSetForce() and llGetForce(). These are experimental and the units may not match the Linden implementation. --- .../Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 1 + OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 1 + OpenSim/Region/Physics/Manager/PhysicsActor.cs | 3 ++- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 1 + OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 10 +++++++--- OpenSim/Region/Physics/POSPlugin/POSCharacter.cs | 1 + OpenSim/Region/Physics/POSPlugin/POSPrim.cs | 1 + OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 2 ++ 8 files changed, 16 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index ee30e54..213f1d4 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -332,6 +332,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 5ef196f..cc55f6e 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -943,6 +943,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 22e21a5..beca4da 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.Physics.Manager public abstract PhysicsVector Position { get; set; } public abstract float Mass { get; } - public abstract PhysicsVector Force { get; } + public abstract PhysicsVector Force { get; set; } public abstract PhysicsVector GeometricCenter { get; } public abstract PhysicsVector CenterOfMass { get; } public abstract PhysicsVector Velocity { get; set; } @@ -277,6 +277,7 @@ namespace OpenSim.Region.Physics.Manager public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 7f08cb4..5d3e986 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -534,6 +534,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsVector Force { get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); } + set { return; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 59655d7..a4c0d79 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -103,6 +103,7 @@ namespace OpenSim.Region.Physics.OdePlugin private CollisionLocker ode; private bool m_taintforce = false; + private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f); private List m_forcelist = new List(); private IMesh _mesh; @@ -749,7 +750,7 @@ namespace OpenSim.Region.Physics.OdePlugin changeshape(timestep); // - if (m_taintforce) + if (m_taintforce || m_force != new PhysicsVector(0.0f, 0.0f, 0.0f)) changeAddForce(timestep); if (m_taintdisable) @@ -1751,7 +1752,8 @@ namespace OpenSim.Region.Physics.OdePlugin //m_log.Info("[PHYSICS]: dequeing forcelist"); if (IsPhysical) { - PhysicsVector iforce = new PhysicsVector(); + //PhysicsVector iforce = new PhysicsVector(); + PhysicsVector iforce = m_force * 100.0f; for (int i = 0; i < m_forcelist.Count; i++) { iforce = iforce + (m_forcelist[i] * 100); @@ -1856,7 +1858,9 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsVector Force { - get { return PhysicsVector.Zero; } + //get { return PhysicsVector.Zero; } + get { return m_force; } + set { m_force = value; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs index d146b60..c674d15 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs @@ -156,6 +156,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs index c767917..fed67dd 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs @@ -118,6 +118,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index c9e1e30..197da0a 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -340,6 +340,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass @@ -669,6 +670,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin public override PhysicsVector Force { get { return PhysicsVector.Zero; } + set { return; } } public override PhysicsVector CenterOfMass -- cgit v1.1