From 0c466b28bbfeac8a4e0c3c61038290621c4f9f4f Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Oct 2009 16:24:43 -0700 Subject: Move the calculation of time dilation from the scene to the physics engine. The scene is still the one reporting dilation so this does not break the API or remove flexibility, but it gets the calculation happening in the right place for the normal OpenSim usage. The actual calculation of physics time dilation probably needs tweaking --- OpenSim/Region/Physics/Manager/PhysicsScene.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Physics/Manager') diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index bb0d18e..6d515e9 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs @@ -75,6 +75,11 @@ namespace OpenSim.Region.Physics.Manager public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical); + public virtual float TimeDilation + { + get { return 1.0f; } + } + public virtual bool SupportsNINJAJoints { get { return false; } -- cgit v1.1 From 713287707595061d7ce343db73edf3462d2d29fc Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 29 Oct 2009 01:46:58 -0700 Subject: * Log progress messages when loading OAR files with a lot of assets * Change the PhysicsCollision callback for objects to send full contact point information. This will be used to calculate the collision plane for avatars * Send the physics engine velocity in terse updates, not the current force being applied to the avatar. This should fix several issues including crouching through the floor and walking through walls --- OpenSim/Region/Physics/Manager/PhysicsActor.cs | 29 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Physics/Manager') diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 6bfdff2..f58129d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -52,6 +52,20 @@ namespace OpenSim.Region.Physics.Manager , Absolute } + public struct ContactPoint + { + public Vector3 Position; + public Vector3 SurfaceNormal; + public float PenetrationDepth; + + public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) + { + Position = position; + SurfaceNormal = surfaceNormal; + PenetrationDepth = penetrationDepth; + } + } + public class CollisionEventUpdate : EventArgs { // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. @@ -59,9 +73,9 @@ namespace OpenSim.Region.Physics.Manager public int m_colliderType; public int m_GenericStartEnd; //public uint m_LocalID; - public Dictionary m_objCollisionList = new Dictionary(); + public Dictionary m_objCollisionList = new Dictionary(); - public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary objCollisionList) + public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary objCollisionList) { m_colliderType = colliderType; m_GenericStartEnd = GenericStartEnd; @@ -72,8 +86,7 @@ namespace OpenSim.Region.Physics.Manager { m_colliderType = (int) ActorTypes.Unknown; m_GenericStartEnd = 1; - // m_objCollisionList = null; - m_objCollisionList = new Dictionary(); + m_objCollisionList = new Dictionary(); } public int collidertype @@ -88,16 +101,16 @@ namespace OpenSim.Region.Physics.Manager set { m_GenericStartEnd = value; } } - public void addCollider(uint localID, float depth) + public void addCollider(uint localID, ContactPoint contact) { if (!m_objCollisionList.ContainsKey(localID)) { - m_objCollisionList.Add(localID, depth); + m_objCollisionList.Add(localID, contact); } else { - if (m_objCollisionList[localID] < depth) - m_objCollisionList[localID] = depth; + if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) + m_objCollisionList[localID] = contact; } } } -- cgit v1.1