From f8e0cf0f1de3cabded7bce2e438cc37ce4bb989c Mon Sep 17 00:00:00 2001 From: darok Date: Sat, 3 Nov 2007 10:25:43 +0000 Subject: Changes in BulletXPlugin: Added new class BulletXActor class inherits from PhysicsActor and it's the ancestor for BulletXCharacter and BulletXPrim.Physical modifications: Changes for pass the value of Physical flag in the SceneObjectPart class to the Physics engines. New call for AddPrimShape so it has a new parameter called "isPhysical". The old call will be obselete soon (i believe). PhysActor and its descendants have a new property called IsPhysical. By the way no new special funcionallity added. It's more like preparing the way for new modifications. --- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 13 ++++- .../Region/Physics/BulletXPlugin/BulletXPlugin.cs | 66 ++++++++-------------- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 8 +++ OpenSim/Region/Physics/Manager/PhysicsScene.cs | 12 +++- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 19 ++++++- OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 19 ++++++- 6 files changed, 90 insertions(+), 47 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index f26b9a1..7c2bbf4 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -101,9 +101,14 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation) { - return null; + return this.AddPrimShape(primName, pbs, position, size, rotation, false); } + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, + PhysicsVector size, Quaternion rotation, bool isPhysical) + { + return null; + } public override void Simulate(float timeStep) { @@ -186,6 +191,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin _acceleration = new PhysicsVector(); } + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { get { return flying; } diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 7159754..5a2b22c 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs @@ -387,6 +387,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, AxiomQuaternion rotation) { + return this.AddPrimShape(primName, pbs, position, size, rotation, false); + } + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, + PhysicsVector size, AxiomQuaternion rotation, bool isPhysical) + { PhysicsActor result; switch (pbs.ProfileShape) @@ -651,10 +656,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin public override PhysicsVector Position { - get - { - return _position; - } + get { return _position; } set { lock (BulletXScene.BulletXLock) @@ -666,10 +668,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin } public override PhysicsVector Velocity { - get - { - return _velocity; - } + get { return _velocity; } set { lock (BulletXScene.BulletXLock) @@ -689,31 +688,16 @@ namespace OpenSim.Region.Physics.BulletXPlugin } public override PhysicsVector Size { - get - { - return _size; - } - set - { - lock (BulletXScene.BulletXLock) - { - _size = value; - } - } + get { return _size; } + set { lock (BulletXScene.BulletXLock) { _size = value; } } } public override PhysicsVector Acceleration { - get - { - return _acceleration; - } + get { return _acceleration; } } public override AxiomQuaternion Orientation { - get - { - return _orientation; - } + get { return _orientation; } set { lock (BulletXScene.BulletXLock) @@ -723,29 +707,29 @@ namespace OpenSim.Region.Physics.BulletXPlugin } } } - public virtual float Mass - { get { return 0; } } + public virtual float Mass + { + get { return 0; } + } public RigidBody RigidBody { - get - { - return rigidBody; - } + get { return rigidBody; } } public Vector3 RigidBodyPosition { get { return this.rigidBody.CenterOfMassPosition; } } + + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { - get - { - return flying; - } - set - { - flying = value; - } + get { return flying; } + set { flying = value; } } public override bool IsColliding { diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index f1d0f84..bfe1d0b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -58,6 +58,8 @@ namespace OpenSim.Region.Physics.Manager public abstract Quaternion Orientation { get; set; } + public abstract bool IsPhysical {get; set;} + public abstract bool Flying { get; set; } public abstract bool IsColliding { get; set; } @@ -100,6 +102,12 @@ namespace OpenSim.Region.Physics.Manager get { return PhysicsVector.Zero; } } + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { get { return false; } diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 3f08234..13591ea 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -45,7 +45,9 @@ namespace OpenSim.Region.Physics.Manager public abstract void RemovePrim(PhysicsActor prim); public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation); + PhysicsVector size, Quaternion rotation); //To be removed + public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, + PhysicsVector size, Quaternion rotation, bool isPhysical); public abstract void Simulate(float timeStep); @@ -82,9 +84,13 @@ namespace OpenSim.Region.Physics.Manager return PhysicsActor.Null; } */ - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation) + PhysicsVector size, Quaternion rotation) //To be removed + { + return this.AddPrimShape(primName, pbs, position, size, rotation, false); + } + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, + PhysicsVector size, Quaternion rotation, bool isPhysical) { MainLog.Instance.Verbose("NullPhysicsScene : AddPrim({0},{1})", position, size); return PhysicsActor.Null; diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 82b94db..f1db034 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -300,7 +300,12 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation) + PhysicsVector size, Quaternion rotation) //To be removed + { + return this.AddPrimShape(primName, pbs, position, size, rotation, false); + } + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, + PhysicsVector size, Quaternion rotation, bool isPhysical) { PhysicsActor result; @@ -510,6 +515,12 @@ namespace OpenSim.Region.Physics.OdePlugin parent_scene.actor_name_map[Shell] = (PhysicsActor)this; } + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { get { return flying; } @@ -758,6 +769,12 @@ namespace OpenSim.Region.Physics.OdePlugin prim_geom = d.CreateTriMesh(parent_scene.space, _triMeshData, parent_scene.triCallback, null, null); } + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { get { return false; //no flying prims for you diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index cad66d7..7a43a0a 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -120,7 +120,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin } public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, - PhysicsVector size, Quaternion rotation) + PhysicsVector size, Quaternion rotation) //To be removed + { + return this.AddPrimShape(primName, pbs, position, size, rotation, false); + } + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, + PhysicsVector size, Quaternion rotation, bool isPhysical) { return AddPrim(position, size, rotation); } @@ -193,6 +198,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin _character = character; } + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { get { return flying; } @@ -305,6 +316,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin _prim = prim; } + public override bool IsPhysical + { + get { return false; } + set { return; } + } + public override bool Flying { get { return false; //no flying prims for you -- cgit v1.1