messing around... Let terrain and water have nullphysicsactors, let
nullphyscisactors have a type water, ground or unknown (default). having this removed geom to name mapping no longer needed. Made some more methods comum to prims and characters acessible via PhysActor allowing for a more uniform access. ...avinationmerge
parent
a492b6f693
commit
62df82b74d
|
@ -43,7 +43,8 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Agent = 1,
|
Agent = 1,
|
||||||
Prim = 2,
|
Prim = 2,
|
||||||
Ground = 3
|
Ground = 3,
|
||||||
|
Water = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PIDHoverType
|
public enum PIDHoverType
|
||||||
|
@ -114,7 +115,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
m_objCollisionList.Add(localID, contact);
|
m_objCollisionList.Add(localID, contact);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
|
if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
|
||||||
m_objCollisionList[localID] = contact;
|
m_objCollisionList[localID] = contact;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +203,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
/// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or
|
/// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or
|
||||||
/// water. This is not a problem due to the formatting of names given by prims and avatars.
|
/// water. This is not a problem due to the formatting of names given by prims and avatars.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public string Name { get; protected set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is being used by ODE joint code.
|
/// This is being used by ODE joint code.
|
||||||
|
@ -230,11 +231,6 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual byte[] Serialize(bool PhysIsRunning)
|
|
||||||
{
|
|
||||||
return new byte[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void RaiseOutOfBounds(Vector3 pos)
|
public virtual void RaiseOutOfBounds(Vector3 pos)
|
||||||
{
|
{
|
||||||
// Make a temporary copy of the event to avoid possibility of
|
// Make a temporary copy of the event to avoid possibility of
|
||||||
|
@ -258,10 +254,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
handler(e);
|
handler(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetMaterial (int material)
|
public virtual void SetMaterial (int material) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual float Density { get; set; }
|
public virtual float Density { get; set; }
|
||||||
public virtual float GravModifier { get; set; }
|
public virtual float GravModifier { get; set; }
|
||||||
public virtual float Friction { get; set; }
|
public virtual float Friction { get; set; }
|
||||||
|
@ -373,13 +366,21 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public abstract void SubscribeEvents(int ms);
|
public abstract void SubscribeEvents(int ms);
|
||||||
public abstract void UnSubscribeEvents();
|
public abstract void UnSubscribeEvents();
|
||||||
public abstract bool SubscribedEvents();
|
public abstract bool SubscribedEvents();
|
||||||
|
|
||||||
|
public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
|
||||||
|
|
||||||
|
// Warning in a parent part it returns itself, not null
|
||||||
|
public virtual PhysicsActor ParentActor { get { return this; } }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NullPhysicsActor : PhysicsActor
|
public class NullPhysicsActor : PhysicsActor
|
||||||
{
|
{
|
||||||
|
private ActorTypes m_actorType = ActorTypes.Unknown;
|
||||||
|
|
||||||
public override bool Stopped
|
public override bool Stopped
|
||||||
{
|
{
|
||||||
get{ return false; }
|
get{ return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 Position
|
public override Vector3 Position
|
||||||
|
@ -396,6 +397,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public override uint LocalID
|
public override uint LocalID
|
||||||
{
|
{
|
||||||
|
get { return 0; }
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,49 +457,17 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void VehicleFloatParam(int param, float value)
|
public override void VehicleFloatParam(int param, float value) {}
|
||||||
{
|
public override void VehicleVectorParam(int param, Vector3 value) { }
|
||||||
}
|
public override void VehicleRotationParam(int param, Quaternion rotation) { }
|
||||||
|
public override void VehicleFlags(int param, bool remove) { }
|
||||||
|
public override void SetVolumeDetect(int param) {}
|
||||||
|
public override void SetMaterial(int material) {}
|
||||||
|
public override Vector3 CenterOfMass { get { return Vector3.Zero; }}
|
||||||
|
|
||||||
public override void VehicleVectorParam(int param, Vector3 value)
|
public override Vector3 GeometricCenter { get { return Vector3.Zero; }}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
public override PrimitiveBaseShape Shape { set { return; }}
|
||||||
|
|
||||||
public override void VehicleRotationParam(int param, Quaternion rotation)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void VehicleFlags(int param, bool remove)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetVolumeDetect(int param)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetMaterial(int material)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 CenterOfMass
|
|
||||||
{
|
|
||||||
get { return Vector3.Zero; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 GeometricCenter
|
|
||||||
{
|
|
||||||
get { return Vector3.Zero; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override PrimitiveBaseShape Shape
|
|
||||||
{
|
|
||||||
set { return; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 Velocity
|
public override Vector3 Velocity
|
||||||
{
|
{
|
||||||
|
@ -517,9 +487,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CrossingFailure()
|
public override void CrossingFailure() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Quaternion Orientation
|
public override Quaternion Orientation
|
||||||
{
|
{
|
||||||
|
@ -559,8 +527,20 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
{
|
{
|
||||||
get { return (int) ActorTypes.Unknown; }
|
get { return (int)m_actorType; }
|
||||||
set { return; }
|
set {
|
||||||
|
ActorTypes type = (ActorTypes)value;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case ActorTypes.Ground:
|
||||||
|
case ActorTypes.Water:
|
||||||
|
m_actorType = type;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_actorType = ActorTypes.Unknown;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Kinematic
|
public override bool Kinematic
|
||||||
|
@ -569,26 +549,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
set { return; }
|
set { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void link(PhysicsActor obj)
|
public override void link(PhysicsActor obj) { }
|
||||||
{
|
public override void delink() { }
|
||||||
}
|
public override void LockAngularMotion(Vector3 axis) { }
|
||||||
|
public override void AddForce(Vector3 force, bool pushforce) { }
|
||||||
public override void delink()
|
public override void AddAngularForce(Vector3 force, bool pushforce) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void LockAngularMotion(Vector3 axis)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void AddForce(Vector3 force, bool pushforce)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Vector3 RotationalVelocity
|
public override Vector3 RotationalVelocity
|
||||||
{
|
{
|
||||||
|
@ -610,22 +575,10 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public override float APIDStrength { set { return; } }
|
public override float APIDStrength { set { return; } }
|
||||||
public override float APIDDamping { set { return; } }
|
public override float APIDDamping { set { return; } }
|
||||||
|
|
||||||
public override void SetMomentum(Vector3 momentum)
|
public override void SetMomentum(Vector3 momentum) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SubscribeEvents(int ms)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public override void UnSubscribeEvents()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
public override bool SubscribedEvents()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public override void SubscribeEvents(int ms) { }
|
||||||
|
public override void UnSubscribeEvents() { }
|
||||||
|
public override bool SubscribedEvents() { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private bool m_freemove = false;
|
private bool m_freemove = false;
|
||||||
// private CollisionLocker ode;
|
// private CollisionLocker ode;
|
||||||
|
|
||||||
private string m_name = String.Empty;
|
// private string m_name = String.Empty;
|
||||||
// other filter control
|
// other filter control
|
||||||
int m_colliderfilter = 0;
|
int m_colliderfilter = 0;
|
||||||
int m_colliderGroundfilter = 0;
|
int m_colliderGroundfilter = 0;
|
||||||
|
@ -183,7 +183,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
m_isPhysical = false; // current status: no ODE information exists
|
m_isPhysical = false; // current status: no ODE information exists
|
||||||
|
|
||||||
m_name = avName;
|
Name = avName;
|
||||||
|
|
||||||
AddChange(changes.Add, null);
|
AddChange(changes.Add, null);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
set { m_localID = value; }
|
set { m_localID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override PhysicsActor ParentActor
|
||||||
|
{
|
||||||
|
get { return (PhysicsActor)this; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Grabbed
|
public override bool Grabbed
|
||||||
{
|
{
|
||||||
set { return; }
|
set { return; }
|
||||||
|
@ -740,7 +745,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//kill the Geometry
|
//kill the Geometry
|
||||||
if (Shell != IntPtr.Zero)
|
if (Shell != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.geom_name_map.Remove(Shell);
|
// _parent_scene.geom_name_map.Remove(Shell);
|
||||||
_parent_scene.actor_name_map.Remove(Shell);
|
_parent_scene.actor_name_map.Remove(Shell);
|
||||||
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
_parent_scene.waitForSpaceUnlock(_parent_scene.ActiveSpace);
|
||||||
d.GeomDestroy(Shell);
|
d.GeomDestroy(Shell);
|
||||||
|
@ -1115,7 +1120,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
m_eventsubscription = 0;
|
m_eventsubscription = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame == null)
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
@ -1184,7 +1189,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z);
|
AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z);
|
||||||
_parent_scene.geom_name_map[Shell] = m_name;
|
|
||||||
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
||||||
_parent_scene.AddCharacter(this);
|
_parent_scene.AddCharacter(this);
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1241,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
_parent_scene.geom_name_map[Shell] = m_name;
|
|
||||||
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private bool m_lastUpdateSent;
|
private bool m_lastUpdateSent;
|
||||||
|
|
||||||
public IntPtr Body = IntPtr.Zero;
|
public IntPtr Body = IntPtr.Zero;
|
||||||
public String Name { get; private set; }
|
// public String Name { get; private set; }
|
||||||
private Vector3 _target_velocity;
|
private Vector3 _target_velocity;
|
||||||
|
|
||||||
public Vector3 primOOBsize; // prim real dimensions from mesh
|
public Vector3 primOOBsize; // prim real dimensions from mesh
|
||||||
|
@ -295,14 +295,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
set { m_localID = value; }
|
set { m_localID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public OdePrim Parent
|
public override PhysicsActor ParentActor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (childPrim)
|
if (childPrim)
|
||||||
return (OdePrim)_parent;
|
return _parent;
|
||||||
else
|
else
|
||||||
return this;
|
return (PhysicsActor)this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +950,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
_parent_scene.RemoveCollisionEventReporting(this);
|
_parent_scene.RemoveCollisionEventReporting(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame == null)
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
@ -1431,6 +1431,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
//Console.WriteLine("SetGeom to " + prim_geom + " for " + Name);
|
//Console.WriteLine("SetGeom to " + prim_geom + " for " + Name);
|
||||||
if (prim_geom != IntPtr.Zero)
|
if (prim_geom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_NoColide)
|
if (m_NoColide)
|
||||||
{
|
{
|
||||||
d.GeomSetCategoryBits(prim_geom, 0);
|
d.GeomSetCategoryBits(prim_geom, 0);
|
||||||
|
@ -1452,7 +1453,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
CalcPrimBodyData();
|
CalcPrimBodyData();
|
||||||
|
|
||||||
_parent_scene.geom_name_map[prim_geom] = Name;
|
|
||||||
_parent_scene.actor_name_map[prim_geom] = this;
|
_parent_scene.actor_name_map[prim_geom] = this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1526,7 +1526,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
if (prim_geom != IntPtr.Zero)
|
if (prim_geom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
_parent_scene.geom_name_map.Remove(prim_geom);
|
// _parent_scene.geom_name_map.Remove(prim_geom);
|
||||||
_parent_scene.actor_name_map.Remove(prim_geom);
|
_parent_scene.actor_name_map.Remove(prim_geom);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -470,56 +470,77 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (p2 == null)
|
if (p2 == null)
|
||||||
{
|
{
|
||||||
string name;
|
/*
|
||||||
|
string name;
|
||||||
|
|
||||||
if (!m_scene.geom_name_map.TryGetValue(g2, out name))
|
if (!m_scene.geom_name_map.TryGetValue(g2, out name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (name == "Terrain")
|
if (name == "Terrain")
|
||||||
{
|
{
|
||||||
// land colision
|
// land colision
|
||||||
if ((CurrentRayFilter & RayFilterFlags.land) == 0)
|
if ((CurrentRayFilter & RayFilterFlags.land) == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (name == "Water")
|
else if (name == "Water")
|
||||||
{
|
{
|
||||||
if ((CurrentRayFilter & RayFilterFlags.water) == 0)
|
if ((CurrentRayFilter & RayFilterFlags.water) == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
*/
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (p2 is OdePrim)
|
switch (p2.PhysicsActorType)
|
||||||
{
|
{
|
||||||
RayFilterFlags thisFlags;
|
case (int)ActorTypes.Prim:
|
||||||
|
|
||||||
if (p2.IsPhysical)
|
RayFilterFlags thisFlags;
|
||||||
thisFlags = RayFilterFlags.physical;
|
|
||||||
else
|
|
||||||
thisFlags = RayFilterFlags.nonphysical;
|
|
||||||
|
|
||||||
if (p2.Phantom)
|
if (p2.IsPhysical)
|
||||||
thisFlags |= RayFilterFlags.phantom;
|
thisFlags = RayFilterFlags.physical;
|
||||||
|
else
|
||||||
|
thisFlags = RayFilterFlags.nonphysical;
|
||||||
|
|
||||||
if (p2.IsVolumeDtc)
|
if (p2.Phantom)
|
||||||
thisFlags |= RayFilterFlags.volumedtc;
|
thisFlags |= RayFilterFlags.phantom;
|
||||||
|
|
||||||
if ((thisFlags & CurrentRayFilter) == 0)
|
if (p2.IsVolumeDtc)
|
||||||
|
thisFlags |= RayFilterFlags.volumedtc;
|
||||||
|
|
||||||
|
if ((thisFlags & CurrentRayFilter) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ID = ((OdePrim)p2).LocalID;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)ActorTypes.Agent:
|
||||||
|
|
||||||
|
if ((CurrentRayFilter & RayFilterFlags.agent) == 0)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
ID = ((OdeCharacter)p2).LocalID;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)ActorTypes.Ground:
|
||||||
|
|
||||||
|
if ((CurrentRayFilter & RayFilterFlags.land) == 0)
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (int)ActorTypes.Water:
|
||||||
|
|
||||||
|
if ((CurrentRayFilter & RayFilterFlags.water) == 0)
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
return;
|
return;
|
||||||
|
break;
|
||||||
ID = ((OdePrim)p2).LocalID;
|
|
||||||
}
|
}
|
||||||
else if (p2 is OdeCharacter)
|
|
||||||
{
|
|
||||||
if ((CurrentRayFilter & RayFilterFlags.agent) == 0)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
ID = ((OdeCharacter)p2).LocalID;
|
|
||||||
}
|
|
||||||
else //??
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d.ContactGeom curcontact = new d.ContactGeom();
|
d.ContactGeom curcontact = new d.ContactGeom();
|
||||||
|
|
|
@ -903,7 +903,7 @@ namespace OdeAPI
|
||||||
public static extern GeomClassID GeomGetClass(IntPtr geom);
|
public static extern GeomClassID GeomGetClass(IntPtr geom);
|
||||||
|
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetData"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetData"), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern IntPtr GeomGetData(IntPtr geom);
|
public static extern IntPtr GeomGetData(IntPtr geom);
|
||||||
|
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity]
|
||||||
public extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom);
|
public extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom);
|
||||||
|
@ -1096,8 +1096,8 @@ namespace OdeAPI
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
|
public static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
|
||||||
|
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetData"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetData"), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern void GeomSetData(IntPtr geom, IntPtr data);
|
public static extern void GeomSetData(IntPtr geom, IntPtr data);
|
||||||
|
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetPosition"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetPosition"), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z);
|
public static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z);
|
||||||
|
|
|
@ -251,7 +251,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
||||||
|
|
||||||
private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
||||||
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
|
// public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
|
||||||
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
||||||
|
|
||||||
private float contactsurfacelayer = 0.002f;
|
private float contactsurfacelayer = 0.002f;
|
||||||
|
@ -274,7 +274,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
private int m_physicsiterations = 10;
|
private int m_physicsiterations = 10;
|
||||||
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
||||||
private PhysicsActor PANull = new NullPhysicsActor();
|
// private PhysicsActor PANull = new NullPhysicsActor();
|
||||||
private float step_time = 0.0f;
|
private float step_time = 0.0f;
|
||||||
|
|
||||||
public IntPtr world;
|
public IntPtr world;
|
||||||
|
@ -713,6 +713,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
|
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
|
if(d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
|
||||||
d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc)
|
d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc)
|
||||||
{
|
{
|
||||||
|
@ -738,7 +739,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// id contacts done
|
// contacts done
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -748,12 +749,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (!actor_name_map.TryGetValue(g1, out p1))
|
if (!actor_name_map.TryGetValue(g1, out p1))
|
||||||
{
|
{
|
||||||
p1 = PANull;
|
m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 1");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!actor_name_map.TryGetValue(g2, out p2))
|
if (!actor_name_map.TryGetValue(g2, out p2))
|
||||||
{
|
{
|
||||||
p2 = PANull;
|
m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 2");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update actors collision score
|
// update actors collision score
|
||||||
|
@ -765,7 +768,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
p2.CollisionScore = 0;
|
p2.CollisionScore = 0;
|
||||||
p2.CollisionScore += count;
|
p2.CollisionScore += count;
|
||||||
|
|
||||||
|
|
||||||
// get first contact
|
// get first contact
|
||||||
d.ContactGeom curContact = new d.ContactGeom();
|
d.ContactGeom curContact = new d.ContactGeom();
|
||||||
if (!GetCurContactGeom(0, ref curContact))
|
if (!GetCurContactGeom(0, ref curContact))
|
||||||
|
@ -798,7 +800,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
ContactData contactdata1 = new ContactData(0, 0, false);
|
ContactData contactdata1 = new ContactData(0, 0, false);
|
||||||
ContactData contactdata2 = new ContactData(0, 0, false);
|
ContactData contactdata2 = new ContactData(0, 0, false);
|
||||||
|
|
||||||
String name = null;
|
|
||||||
bool dop1foot = false;
|
bool dop1foot = false;
|
||||||
bool dop2foot = false;
|
bool dop2foot = false;
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
|
@ -830,34 +831,16 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
switch (p2.PhysicsActorType)
|
switch (p2.PhysicsActorType)
|
||||||
{
|
{
|
||||||
case (int)ActorTypes.Agent:
|
case (int)ActorTypes.Agent:
|
||||||
/*
|
|
||||||
p1.getContactData(ref contactdata1);
|
|
||||||
p2.getContactData(ref contactdata2);
|
|
||||||
|
|
||||||
mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
|
|
||||||
|
|
||||||
if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
|
|
||||||
mu *= frictionMovementMult;
|
|
||||||
*/
|
|
||||||
p1.CollidingObj = true;
|
p1.CollidingObj = true;
|
||||||
p2.CollidingObj = true;
|
p2.CollidingObj = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ActorTypes.Prim:
|
case (int)ActorTypes.Prim:
|
||||||
/*
|
|
||||||
p1.getContactData(ref contactdata1);
|
|
||||||
p2.getContactData(ref contactdata2);
|
|
||||||
|
|
||||||
|
|
||||||
mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
|
|
||||||
|
|
||||||
if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
|
|
||||||
mu *= frictionMovementMult;
|
|
||||||
*/
|
|
||||||
if (p2.Velocity.LengthSquared() > 0.0f)
|
if (p2.Velocity.LengthSquared() > 0.0f)
|
||||||
p2.CollidingObj = true;
|
p2.CollidingObj = true;
|
||||||
|
|
||||||
dop1foot = true;
|
dop1foot = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ignore = true; // avatar to terrain and water ignored
|
ignore = true; // avatar to terrain and water ignored
|
||||||
break;
|
break;
|
||||||
|
@ -869,9 +852,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
switch (p2.PhysicsActorType)
|
switch (p2.PhysicsActorType)
|
||||||
{
|
{
|
||||||
case (int)ActorTypes.Agent:
|
case (int)ActorTypes.Agent:
|
||||||
// p1.getContactData(ref contactdata1);
|
|
||||||
// p2.getContactData(ref contactdata2);
|
|
||||||
|
|
||||||
AvanormOverride = true;
|
AvanormOverride = true;
|
||||||
|
|
||||||
Vector3 tmp = p2.Position - p1.Position;
|
Vector3 tmp = p2.Position - p1.Position;
|
||||||
|
@ -894,16 +874,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
bounce = 0;
|
bounce = 0;
|
||||||
mu = 0;
|
mu = 0;
|
||||||
cfm = 0.0001f;
|
cfm = 0.0001f;
|
||||||
/*
|
|
||||||
mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
|
|
||||||
|
|
||||||
if ((Math.Abs(p2.Velocity.X - p1.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y - p1.Velocity.Y) > 0.1f))
|
|
||||||
mu *= frictionMovementMult;
|
|
||||||
*/
|
|
||||||
dop2foot = true;
|
dop2foot = true;
|
||||||
if (p1.Velocity.LengthSquared() > 0.0f)
|
if (p1.Velocity.LengthSquared() > 0.0f)
|
||||||
p1.CollidingObj = true;
|
p1.CollidingObj = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ActorTypes.Prim:
|
case (int)ActorTypes.Prim:
|
||||||
if ((p1.Velocity - p2.Velocity).LengthSquared() > 0.0f)
|
if ((p1.Velocity - p2.Velocity).LengthSquared() > 0.0f)
|
||||||
{
|
{
|
||||||
|
@ -933,95 +909,77 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
mu *= frictionMovementMult;
|
mu *= frictionMovementMult;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
if (geom_name_map.TryGetValue(g2, out name))
|
case (int)ActorTypes.Ground:
|
||||||
|
p1.getContactData(ref contactdata1);
|
||||||
|
bounce = contactdata1.bounce * TerrainBounce;
|
||||||
|
mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
|
||||||
|
if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f)
|
||||||
|
mu *= frictionMovementMult;
|
||||||
|
p1.CollidingGround = true;
|
||||||
|
|
||||||
|
cfm = p1.Mass;
|
||||||
|
dscale = 10 / cfm;
|
||||||
|
dscale = (float)Math.Sqrt(dscale);
|
||||||
|
if (dscale > 1.0f)
|
||||||
|
dscale = 1.0f;
|
||||||
|
erpscale = cfm * 0.01f;
|
||||||
|
cfm = 0.0001f / cfm;
|
||||||
|
if (cfm > 0.01f)
|
||||||
|
cfm = 0.01f;
|
||||||
|
else if (cfm < 0.00001f)
|
||||||
|
cfm = 0.00001f;
|
||||||
|
|
||||||
|
if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
||||||
{
|
{
|
||||||
if (name == "Terrain")
|
if (curContact.side1 > 0)
|
||||||
{
|
IgnoreNegSides = true;
|
||||||
p1.getContactData(ref contactdata1);
|
|
||||||
bounce = contactdata1.bounce * TerrainBounce;
|
|
||||||
mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
|
|
||||||
if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f)
|
|
||||||
mu *= frictionMovementMult;
|
|
||||||
p1.CollidingGround = true;
|
|
||||||
|
|
||||||
cfm = p1.Mass;
|
|
||||||
dscale = 10 / cfm;
|
|
||||||
dscale = (float)Math.Sqrt(dscale);
|
|
||||||
if (dscale > 1.0f)
|
|
||||||
dscale = 1.0f;
|
|
||||||
erpscale = cfm * 0.01f;
|
|
||||||
cfm = 0.0001f / cfm;
|
|
||||||
if (cfm > 0.01f)
|
|
||||||
cfm = 0.01f;
|
|
||||||
else if (cfm < 0.00001f)
|
|
||||||
cfm = 0.00001f;
|
|
||||||
|
|
||||||
if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass)
|
|
||||||
{
|
|
||||||
if (curContact.side1 > 0)
|
|
||||||
IgnoreNegSides = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (name == "Water")
|
|
||||||
{
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
ignore = true;
|
|
||||||
|
case (int)ActorTypes.Water:
|
||||||
|
default:
|
||||||
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case (int)ActorTypes.Ground:
|
||||||
if (geom_name_map.TryGetValue(g1, out name))
|
if (p2.PhysicsActorType == (int)ActorTypes.Prim)
|
||||||
{
|
{
|
||||||
if (name == "Terrain")
|
p2.CollidingGround = true;
|
||||||
{
|
p2.getContactData(ref contactdata2);
|
||||||
if (p2.PhysicsActorType == (int)ActorTypes.Prim)
|
bounce = contactdata2.bounce * TerrainBounce;
|
||||||
{
|
mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction);
|
||||||
p2.CollidingGround = true;
|
|
||||||
p2.getContactData(ref contactdata2);
|
|
||||||
bounce = contactdata2.bounce * TerrainBounce;
|
|
||||||
mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction);
|
|
||||||
|
|
||||||
cfm = p2.Mass;
|
cfm = p2.Mass;
|
||||||
dscale = 10 / cfm;
|
dscale = 10 / cfm;
|
||||||
dscale = (float)Math.Sqrt(dscale);
|
dscale = (float)Math.Sqrt(dscale);
|
||||||
|
|
||||||
if (dscale > 1.0f)
|
if (dscale > 1.0f)
|
||||||
dscale = 1.0f;
|
dscale = 1.0f;
|
||||||
|
|
||||||
erpscale = cfm * 0.01f;
|
erpscale = cfm * 0.01f;
|
||||||
cfm = 0.0001f / cfm;
|
cfm = 0.0001f / cfm;
|
||||||
if (cfm > 0.01f)
|
if (cfm > 0.01f)
|
||||||
cfm = 0.01f;
|
cfm = 0.01f;
|
||||||
else if (cfm < 0.00001f)
|
else if (cfm < 0.00001f)
|
||||||
cfm = 0.00001f;
|
cfm = 0.00001f;
|
||||||
|
|
||||||
if (curContact.side1 > 0) // should be 2 ?
|
if (curContact.side1 > 0) // should be 2 ?
|
||||||
IgnoreNegSides = true;
|
IgnoreNegSides = true;
|
||||||
|
|
||||||
if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f)
|
if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f)
|
||||||
mu *= frictionMovementMult;
|
mu *= frictionMovementMult;
|
||||||
}
|
|
||||||
else
|
|
||||||
ignore = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (name == "Water" &&
|
|
||||||
(p2.PhysicsActorType == (int)ActorTypes.Prim || p2.PhysicsActorType == (int)ActorTypes.Agent))
|
|
||||||
{
|
|
||||||
ignore = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
|
case (int)ActorTypes.Water:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (ignore)
|
if (ignore)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1162,36 +1120,23 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
|
private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
|
||||||
{
|
{
|
||||||
|
|
||||||
OdeCharacter cc1;
|
|
||||||
OdePrim cp1;
|
|
||||||
OdeCharacter cc2;
|
|
||||||
OdePrim cp2;
|
|
||||||
OdePrim cp1Parent;
|
|
||||||
OdePrim cp2Parent;
|
|
||||||
|
|
||||||
uint obj2LocalID = 0;
|
uint obj2LocalID = 0;
|
||||||
|
|
||||||
bool p1events = p1.SubscribedEvents();
|
bool p1events = p1.SubscribedEvents();
|
||||||
bool p2events = p2.SubscribedEvents();
|
bool p2events = p2.SubscribedEvents();
|
||||||
|
|
||||||
if (p1.IsVolumeDtc)
|
if (p1.IsVolumeDtc)
|
||||||
p2events = false;
|
p2events = false;
|
||||||
if (p2.IsVolumeDtc)
|
if (p2.IsVolumeDtc)
|
||||||
p1events = false;
|
p1events = false;
|
||||||
|
|
||||||
if (!(p2events || p1events))
|
if (!p2events && !p1events)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (p1events)
|
|
||||||
AddCollisionEventReporting(p1);
|
|
||||||
|
|
||||||
if (p2events)
|
|
||||||
AddCollisionEventReporting(p2);
|
|
||||||
|
|
||||||
Vector3 vel = Vector3.Zero;
|
Vector3 vel = Vector3.Zero;
|
||||||
if (p2 != null && p2.IsPhysical)
|
if (p2 != null && p2.IsPhysical)
|
||||||
vel = p2.Velocity;
|
vel = p2.Velocity;
|
||||||
|
@ -1200,71 +1145,22 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
vel -= p1.Velocity;
|
vel -= p1.Velocity;
|
||||||
|
|
||||||
contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
|
contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
|
||||||
|
|
||||||
switch ((ActorTypes)p1.PhysicsActorType)
|
switch ((ActorTypes)p1.PhysicsActorType)
|
||||||
{
|
{
|
||||||
case ActorTypes.Agent:
|
case ActorTypes.Agent:
|
||||||
cc1 = (OdeCharacter)p1;
|
|
||||||
switch ((ActorTypes)p2.PhysicsActorType)
|
|
||||||
{
|
|
||||||
case ActorTypes.Agent:
|
|
||||||
cc2 = (OdeCharacter)p2;
|
|
||||||
obj2LocalID = cc2.LocalID;
|
|
||||||
if (p2events)
|
|
||||||
cc2.AddCollisionEvent(cc1.LocalID, contact);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ActorTypes.Prim:
|
|
||||||
if (p2 is OdePrim)
|
|
||||||
{
|
|
||||||
cp2 = (OdePrim)p2;
|
|
||||||
if (p2events)
|
|
||||||
cp2.AddCollisionEvent(cc1.LocalID, contact);
|
|
||||||
cp2 = cp2.Parent;
|
|
||||||
obj2LocalID = cp2.LocalID;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ActorTypes.Ground:
|
|
||||||
case ActorTypes.Unknown:
|
|
||||||
default:
|
|
||||||
obj2LocalID = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (p1events)
|
|
||||||
{
|
|
||||||
contact.SurfaceNormal = -contact.SurfaceNormal;
|
|
||||||
cc1.AddCollisionEvent(obj2LocalID, contact);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ActorTypes.Prim:
|
case ActorTypes.Prim:
|
||||||
|
{
|
||||||
if (p1 is OdePrim)
|
|
||||||
{
|
|
||||||
cp1 = (OdePrim)p1;
|
|
||||||
cp1Parent = cp1.Parent;
|
|
||||||
switch ((ActorTypes)p2.PhysicsActorType)
|
switch ((ActorTypes)p2.PhysicsActorType)
|
||||||
{
|
{
|
||||||
case ActorTypes.Agent:
|
case ActorTypes.Agent:
|
||||||
if (p2 is OdeCharacter)
|
|
||||||
{
|
|
||||||
cc2 = (OdeCharacter)p2;
|
|
||||||
obj2LocalID = cc2.LocalID;
|
|
||||||
if (p2events)
|
|
||||||
cc2.AddCollisionEvent(cp1Parent.LocalID, contact);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ActorTypes.Prim:
|
case ActorTypes.Prim:
|
||||||
|
if (p2events)
|
||||||
if (p2 is OdePrim)
|
{
|
||||||
{
|
AddCollisionEventReporting(p2);
|
||||||
cp2 = (OdePrim)p2;
|
p2.AddCollisionEvent(p1.ParentActor.LocalID, contact);
|
||||||
if (p2events)
|
}
|
||||||
cp2.AddCollisionEvent(cp1Parent.LocalID, contact);
|
obj2LocalID = p2.ParentActor.LocalID;
|
||||||
cp2 = cp2.Parent;
|
|
||||||
obj2LocalID = cp2.LocalID;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActorTypes.Ground:
|
case ActorTypes.Ground:
|
||||||
|
@ -1272,41 +1168,28 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
default:
|
default:
|
||||||
obj2LocalID = 0;
|
obj2LocalID = 0;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
if (p1events)
|
|
||||||
{
|
|
||||||
contact.SurfaceNormal = -contact.SurfaceNormal;
|
|
||||||
cp1.AddCollisionEvent(obj2LocalID, contact);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
if (p1events)
|
||||||
|
{
|
||||||
|
contact.SurfaceNormal = -contact.SurfaceNormal;
|
||||||
|
AddCollisionEventReporting(p1);
|
||||||
|
p1.AddCollisionEvent(obj2LocalID, contact);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActorTypes.Ground:
|
case ActorTypes.Ground:
|
||||||
case ActorTypes.Unknown:
|
case ActorTypes.Unknown:
|
||||||
default:
|
default:
|
||||||
switch ((ActorTypes)p2.PhysicsActorType)
|
{
|
||||||
|
if (p2events && !p2.IsVolumeDtc)
|
||||||
{
|
{
|
||||||
case ActorTypes.Agent:
|
AddCollisionEventReporting(p2);
|
||||||
if (p2 is OdeCharacter)
|
p2.AddCollisionEvent(0, contact);
|
||||||
{
|
|
||||||
cc2 = (OdeCharacter)p2;
|
|
||||||
obj2LocalID = cc2.LocalID;
|
|
||||||
if (p2events)
|
|
||||||
cc2.AddCollisionEvent(0, contact);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ActorTypes.Prim:
|
|
||||||
if (p2 is OdePrim)
|
|
||||||
{
|
|
||||||
cp2 = (OdePrim)p2;
|
|
||||||
obj2LocalID = cp2.LocalID;
|
|
||||||
if (p2events)
|
|
||||||
cp2.AddCollisionEvent(0, contact);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is our collision testing routine in ODE
|
/// This is our collision testing routine in ODE
|
||||||
|
@ -2369,6 +2252,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
RegionTerrain.Remove(pOffset);
|
RegionTerrain.Remove(pOffset);
|
||||||
if (GroundGeom != IntPtr.Zero)
|
if (GroundGeom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
actor_name_map.Remove(GroundGeom);
|
||||||
d.GeomDestroy(GroundGeom);
|
d.GeomDestroy(GroundGeom);
|
||||||
|
|
||||||
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
||||||
|
@ -2394,27 +2278,32 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));
|
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));
|
||||||
d.GeomSetCollideBits(GroundGeom, 0);
|
d.GeomSetCollideBits(GroundGeom, 0);
|
||||||
|
|
||||||
|
PhysicsActor pa = new NullPhysicsActor();
|
||||||
|
pa.Name = "Terrain";
|
||||||
|
pa.PhysicsActorType = (int)ActorTypes.Ground;
|
||||||
|
actor_name_map[GroundGeom] = pa;
|
||||||
|
|
||||||
|
// geom_name_map[GroundGeom] = "Terrain";
|
||||||
|
|
||||||
|
d.Matrix3 R = new d.Matrix3();
|
||||||
|
|
||||||
|
Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
|
||||||
|
Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
|
||||||
|
|
||||||
|
|
||||||
|
q1 = q1 * q2;
|
||||||
|
|
||||||
|
Vector3 v3;
|
||||||
|
float angle;
|
||||||
|
q1.GetAxisAngle(out v3, out angle);
|
||||||
|
|
||||||
|
d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
||||||
|
d.GeomSetRotation(GroundGeom, ref R);
|
||||||
|
d.GeomSetPosition(GroundGeom, pOffset.X + (float)Constants.RegionSize * 0.5f, pOffset.Y + (float)Constants.RegionSize * 0.5f, 0);
|
||||||
|
RegionTerrain.Add(pOffset, GroundGeom);
|
||||||
|
TerrainHeightFieldHeights.Add(GroundGeom, _heightmap);
|
||||||
|
TerrainHeightFieldHeightsHandlers.Add(GroundGeom, _heightmaphandler);
|
||||||
}
|
}
|
||||||
geom_name_map[GroundGeom] = "Terrain";
|
|
||||||
|
|
||||||
d.Matrix3 R = new d.Matrix3();
|
|
||||||
|
|
||||||
Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
|
|
||||||
Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
|
|
||||||
|
|
||||||
|
|
||||||
q1 = q1 * q2;
|
|
||||||
|
|
||||||
Vector3 v3;
|
|
||||||
float angle;
|
|
||||||
q1.GetAxisAngle(out v3, out angle);
|
|
||||||
|
|
||||||
d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
|
||||||
d.GeomSetRotation(GroundGeom, ref R);
|
|
||||||
d.GeomSetPosition(GroundGeom, pOffset.X + (float)Constants.RegionSize * 0.5f, pOffset.Y + (float)Constants.RegionSize * 0.5f, 0);
|
|
||||||
RegionTerrain.Add(pOffset, GroundGeom);
|
|
||||||
TerrainHeightFieldHeights.Add(GroundGeom, _heightmap);
|
|
||||||
TerrainHeightFieldHeightsHandlers.Add(GroundGeom, _heightmaphandler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2478,6 +2367,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
RegionTerrain.Remove(pOffset);
|
RegionTerrain.Remove(pOffset);
|
||||||
if (GroundGeom != IntPtr.Zero)
|
if (GroundGeom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
actor_name_map.Remove(GroundGeom);
|
||||||
d.GeomDestroy(GroundGeom);
|
d.GeomDestroy(GroundGeom);
|
||||||
|
|
||||||
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
||||||
|
@ -2509,13 +2399,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));
|
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));
|
||||||
d.GeomSetCollideBits(GroundGeom, 0);
|
d.GeomSetCollideBits(GroundGeom, 0);
|
||||||
|
|
||||||
}
|
PhysicsActor pa = new NullPhysicsActor();
|
||||||
geom_name_map[GroundGeom] = "Terrain";
|
pa.Name = "Terrain";
|
||||||
|
pa.PhysicsActorType = (int)ActorTypes.Ground;
|
||||||
|
actor_name_map[GroundGeom] = pa;
|
||||||
|
|
||||||
d.GeomSetPosition(GroundGeom, pOffset.X + (float)Constants.RegionSize * 0.5f, pOffset.Y + (float)Constants.RegionSize * 0.5f, 0);
|
// geom_name_map[GroundGeom] = "Terrain";
|
||||||
RegionTerrain.Add(pOffset, GroundGeom);
|
|
||||||
TerrainHeightFieldHeights.Add(GroundGeom, _heightmap);
|
d.GeomSetPosition(GroundGeom, pOffset.X + (float)Constants.RegionSize * 0.5f, pOffset.Y + (float)Constants.RegionSize * 0.5f, 0);
|
||||||
TerrainHeightFieldHeightsHandlers.Add(GroundGeom, _heightmaphandler);
|
RegionTerrain.Add(pOffset, GroundGeom);
|
||||||
|
TerrainHeightFieldHeights.Add(GroundGeom, _heightmap);
|
||||||
|
TerrainHeightFieldHeightsHandlers.Add(GroundGeom, _heightmaphandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2632,6 +2527,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
if (WaterGeom != IntPtr.Zero)
|
if (WaterGeom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
actor_name_map.Remove(WaterGeom);
|
||||||
d.GeomDestroy(WaterGeom);
|
d.GeomDestroy(WaterGeom);
|
||||||
d.GeomHeightfieldDataDestroy(WaterHeightmapData);
|
d.GeomHeightfieldDataDestroy(WaterHeightmapData);
|
||||||
WaterGeom = IntPtr.Zero;
|
WaterGeom = IntPtr.Zero;
|
||||||
|
@ -2654,7 +2550,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
d.GeomSetCategoryBits(WaterGeom, (uint)(CollisionCategories.Water));
|
d.GeomSetCategoryBits(WaterGeom, (uint)(CollisionCategories.Water));
|
||||||
d.GeomSetCollideBits(WaterGeom, 0);
|
d.GeomSetCollideBits(WaterGeom, 0);
|
||||||
|
|
||||||
geom_name_map[WaterGeom] = "Water";
|
|
||||||
|
PhysicsActor pa = new NullPhysicsActor();
|
||||||
|
pa.Name = "Water";
|
||||||
|
pa.PhysicsActorType = (int)ActorTypes.Water;
|
||||||
|
|
||||||
|
actor_name_map[WaterGeom] = pa;
|
||||||
|
// geom_name_map[WaterGeom] = "Water";
|
||||||
|
|
||||||
d.Matrix3 R = new d.Matrix3();
|
d.Matrix3 R = new d.Matrix3();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue