From 85f578999320ab4b3b87d99c6901e7dfc86f8cc3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 May 2012 12:35:17 +0100 Subject: [PATCH 1/3] try to let avas climb higher steps. Will only work in some cases, may have bad effects, so needs some more testing --- .../Region/Physics/UbitOdePlugin/ODEPrim.cs | 2 +- .../Region/Physics/UbitOdePlugin/OdeScene.cs | 82 +++++++++++++++++-- 2 files changed, 75 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 62fd279464..459cd277c6 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -2562,10 +2562,10 @@ namespace OpenSim.Region.Physics.OdePlugin { d.Quaternion qtmp; d.GeomCopyQuaternion(prim_geom, out qtmp); - _orientation.W = qtmp.W; _orientation.X = qtmp.X; _orientation.Y = qtmp.Y; _orientation.Z = qtmp.Z; + _orientation.W = qtmp.W; d.Vector3 lpos = d.GeomGetPosition(prim_geom); _position.X = lpos.X; diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index bfcfd21a97..d5968fc3d5 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1006,16 +1006,82 @@ namespace OpenSim.Region.Physics.OdePlugin else { - if (dop1foot && (p1.Position.Z - curContact.pos.Z) > (p1.Size.Z - avCapRadius) * 0.5f) - p1.IsColliding = true; - if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f) - p2.IsColliding = true; - if (AvanormOverride && curContact.depth > 0.3f) + if (AvanormOverride) { - curContact.normal.X = normoverride.X; - curContact.normal.Y = normoverride.Y; - curContact.normal.Z = normoverride.Z; + if (curContact.depth > 0.3f) + { + if (dop1foot && (p1.Position.Z - curContact.pos.Z) > (p1.Size.Z - avCapRadius) * 0.5f) + p1.IsColliding = true; + if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f) + p2.IsColliding = true; + curContact.normal.X = normoverride.X; + curContact.normal.Y = normoverride.Y; + curContact.normal.Z = normoverride.Z; + } + + else + { + if (dop1foot) + { + float sz = p1.Size.Z; + Vector3 vtmp = p1.Position; + float ppos = curContact.pos.Z - vtmp.Z + (sz - avCapRadius) * 0.5f; + if (ppos > 0f) + { + if (!p1.Flying) + { + d.AABB aabb; + d.GeomGetAABB(g2, out aabb); + float tmp = vtmp.Z - sz * .25f; + + if (aabb.MaxZ < tmp) + { + vtmp.X = curContact.pos.X - vtmp.X; + vtmp.Y = curContact.pos.Y - vtmp.Y; + vtmp.Z = -0.2f; + vtmp.Normalize(); + curContact.normal.X = vtmp.X; + curContact.normal.Y = vtmp.Y; + curContact.normal.Z = vtmp.Z; + } + } + } + else + p1.IsColliding = true; + + } + + if (dop2foot) + { + float sz = p2.Size.Z; + Vector3 vtmp = p2.Position; + float ppos = curContact.pos.Z - vtmp.Z + (sz - avCapRadius) * 0.5f; + if (ppos > 0f) + { + if (!p2.Flying) + { + d.AABB aabb; + d.GeomGetAABB(g1, out aabb); + float tmp = vtmp.Z - sz * .25f; + + if (aabb.MaxZ < tmp) + { + vtmp.X = curContact.pos.X - vtmp.X; + vtmp.Y = curContact.pos.Y - vtmp.Y; + vtmp.Z = -0.2f; + vtmp.Normalize(); + curContact.normal.X = vtmp.X; + curContact.normal.Y = vtmp.Y; + curContact.normal.Z = vtmp.Z; + } + } + } + else + p2.IsColliding = true; + + } + } } Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); From d2260423e5e955b4e0f33f279e64cf74d580dc37 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 May 2012 17:11:19 +0100 Subject: [PATCH 2/3] also don't collide sculps or meshs if meshing is OFF --- OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 459cd277c6..496e7ace48 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -1482,6 +1482,8 @@ namespace OpenSim.Region.Physics.OdePlugin if (!haveMesh) m_NoColide = true; } + else if(_pbs.SculptEntry) + m_NoColide = true; // also don't colide if is a sculp or mesh and meshing is off if (!haveMesh) { From f740c9522aa5fd57ffd2d01fa9c2e244113ac880 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 27 May 2012 14:01:42 +0100 Subject: [PATCH 3/3] Let OOB information usable outside ubitode --- .../Region/Physics/Manager/PhysicsActor.cs | 29 ++++++++++++++++++- .../Physics/UbitOdePlugin/ODECharacter.cs | 23 --------------- .../Region/Physics/UbitOdePlugin/ODEPrim.cs | 10 +++---- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index fb90887f6d..aaeae86f3d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -294,6 +294,34 @@ namespace OpenSim.Region.Physics.Manager public abstract Vector3 GeometricCenter { get; } public abstract Vector3 CenterOfMass { get; } + public virtual Vector3 OOBsize + { + get + { + Vector3 s=Size; + s.X *=0.5f; + s.Y *=0.5f; + s.Z *=0.5f; + return s; + } + } + + public virtual Vector3 OOBoffset + { + get + { + return Vector3.Zero; + } + } + + public virtual float OOBRadiusSQ + { + get + { + return Size.LengthSquared() * 0.25f; // ((0.5^2) + } + } + /// /// Velocity of this actor. /// @@ -429,7 +457,6 @@ namespace OpenSim.Region.Physics.Manager public override void VehicleFloatParam(int param, float value) { - } public override void VehicleVectorParam(int param, Vector3 value) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 1084b0e2a7..6fb54cb09d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -522,29 +522,6 @@ namespace OpenSim.Region.Physics.OdePlugin } } - //UBit mess - /* for later use - public override Vector3 PrimOOBsize - { - get - { - Vector3 s=Size; - s.X *=0.5f; - s.Y *=0.5f; - s.Z *=0.5f; - return s; - } - } - - public override Vector3 PrimOOBoffset - { - get - { - return Vector3.Zero; - } - } - */ - public override PrimitiveBaseShape Shape { set { return; } diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 496e7ace48..1bfe08bdb1 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -504,8 +504,8 @@ namespace OpenSim.Region.Physics.OdePlugin } } } -/* - public override Vector3 PrimOOBsize + + public override Vector3 OOBsize { get { @@ -513,7 +513,7 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override Vector3 PrimOOBoffset + public override Vector3 OOBoffset { get { @@ -521,14 +521,14 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override float PrimOOBRadiusSQ + public override float OOBRadiusSQ { get { return primOOBradiusSQ; } } -*/ + public override PrimitiveBaseShape Shape { set