From 7a5f598399c7373bd146061b478e6d04cb204879 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 27 Dec 2012 16:05:11 -0800 Subject: BulletSim: move logic for IsColliding, CollidingGround and CollidingObj from individual sub-classes and up to parent BSPhysObject class. --- .../Region/Physics/BulletSPlugin/BSPhysObject.cs | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 4bed535..73b5764 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -182,9 +182,40 @@ public abstract class BSPhysObject : PhysicsActor protected long CollidingStep { get; set; } // The simulation step that last had a collision with the ground protected long CollidingGroundStep { get; set; } + // The simulation step that last collided with an object + protected long CollidingObjectStep { get; set; } // The collision flags we think are set in Bullet protected CollisionFlags CurrentCollisionFlags { get; set; } + public override bool IsColliding { + get { return (CollidingStep == PhysicsScene.SimulationStep); } + set { + if (value) + CollidingStep = PhysicsScene.SimulationStep; + else + CollidingStep = 0; + } + } + public override bool CollidingGround { + get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } + set + { + if (value) + CollidingGroundStep = PhysicsScene.SimulationStep; + else + CollidingGroundStep = 0; + } + } + public override bool CollidingObj { + get { return (CollidingObjectStep == PhysicsScene.SimulationStep); } + set { + if (value) + CollidingObjectStep = PhysicsScene.SimulationStep; + else + CollidingObjectStep = 0; + } + } + // The collisions that have been collected this tick protected CollisionEventUpdate CollisionCollection; @@ -196,12 +227,16 @@ public abstract class BSPhysObject : PhysicsActor { bool ret = false; - // The following lines make IsColliding() and IsCollidingGround() work + // The following lines make IsColliding(), CollidingGround() and CollidingObj work CollidingStep = PhysicsScene.SimulationStep; if (collidingWith <= PhysicsScene.TerrainManager.HighestTerrainID) { CollidingGroundStep = PhysicsScene.SimulationStep; } + else + { + CollidingObjectStep = PhysicsScene.SimulationStep; + } // prims in the same linkset cannot collide with each other if (collidee != null && (this.Linkset.LinksetID == collidee.Linkset.LinksetID)) -- cgit v1.1