Merge branch 'master' of /home/opensim/var/repo/opensim
commit
05b369965e
|
@ -1042,142 +1042,146 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
/// <param name="prim">Child prim</param>
|
/// <param name="prim">Child prim</param>
|
||||||
private void AddChildPrim(OdePrim prim)
|
private void AddChildPrim(OdePrim prim)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("AddChildPrim " + Name);
|
if (LocalID == prim.LocalID)
|
||||||
if (LocalID != prim.LocalID)
|
return;
|
||||||
|
|
||||||
|
if (Body == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (Body == IntPtr.Zero)
|
Body = d.BodyCreate(_parent_scene.world);
|
||||||
|
setMass();
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (childrenPrim)
|
||||||
|
{
|
||||||
|
if (childrenPrim.Contains(prim))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ODE PRIM]: Linking prim {0} {1} to {2} {3}", prim.Name, prim.LocalID, Name, LocalID);
|
||||||
|
|
||||||
|
childrenPrim.Add(prim);
|
||||||
|
|
||||||
|
foreach (OdePrim prm in childrenPrim)
|
||||||
{
|
{
|
||||||
Body = d.BodyCreate(_parent_scene.world);
|
d.Mass m2;
|
||||||
setMass();
|
d.MassSetZero(out m2);
|
||||||
|
d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
|
||||||
|
|
||||||
|
d.Quaternion quat = new d.Quaternion();
|
||||||
|
quat.W = prm._orientation.W;
|
||||||
|
quat.X = prm._orientation.X;
|
||||||
|
quat.Y = prm._orientation.Y;
|
||||||
|
quat.Z = prm._orientation.Z;
|
||||||
|
|
||||||
|
d.Matrix3 mat = new d.Matrix3();
|
||||||
|
d.RfromQ(out mat, ref quat);
|
||||||
|
d.MassRotate(ref m2, ref mat);
|
||||||
|
d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
|
||||||
|
d.MassAdd(ref pMass, ref m2);
|
||||||
}
|
}
|
||||||
if (Body != IntPtr.Zero)
|
|
||||||
|
foreach (OdePrim prm in childrenPrim)
|
||||||
{
|
{
|
||||||
lock (childrenPrim)
|
prm.m_collisionCategories |= CollisionCategories.Body;
|
||||||
{
|
prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
||||||
if (!childrenPrim.Contains(prim))
|
|
||||||
{
|
|
||||||
//Console.WriteLine("childrenPrim.Add " + prim);
|
|
||||||
childrenPrim.Add(prim);
|
|
||||||
|
|
||||||
foreach (OdePrim prm in childrenPrim)
|
|
||||||
{
|
|
||||||
d.Mass m2;
|
|
||||||
d.MassSetZero(out m2);
|
|
||||||
d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
|
|
||||||
|
|
||||||
d.Quaternion quat = new d.Quaternion();
|
|
||||||
quat.W = prm._orientation.W;
|
|
||||||
quat.X = prm._orientation.X;
|
|
||||||
quat.Y = prm._orientation.Y;
|
|
||||||
quat.Z = prm._orientation.Z;
|
|
||||||
|
|
||||||
d.Matrix3 mat = new d.Matrix3();
|
|
||||||
d.RfromQ(out mat, ref quat);
|
|
||||||
d.MassRotate(ref m2, ref mat);
|
|
||||||
d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
|
|
||||||
d.MassAdd(ref pMass, ref m2);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (OdePrim prm in childrenPrim)
|
|
||||||
{
|
|
||||||
prm.m_collisionCategories |= CollisionCategories.Body;
|
|
||||||
prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
|
||||||
|
|
||||||
//Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name);
|
//Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name);
|
||||||
d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
|
d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
|
||||||
d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
|
d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
|
||||||
|
|
||||||
d.Quaternion quat = new d.Quaternion();
|
d.Quaternion quat = new d.Quaternion();
|
||||||
quat.W = prm._orientation.W;
|
quat.W = prm._orientation.W;
|
||||||
quat.X = prm._orientation.X;
|
quat.X = prm._orientation.X;
|
||||||
quat.Y = prm._orientation.Y;
|
quat.Y = prm._orientation.Y;
|
||||||
quat.Z = prm._orientation.Z;
|
quat.Z = prm._orientation.Z;
|
||||||
|
|
||||||
d.Matrix3 mat = new d.Matrix3();
|
d.Matrix3 mat = new d.Matrix3();
|
||||||
d.RfromQ(out mat, ref quat);
|
d.RfromQ(out mat, ref quat);
|
||||||
if (Body != IntPtr.Zero)
|
if (Body != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
d.GeomSetBody(prm.prim_geom, Body);
|
d.GeomSetBody(prm.prim_geom, Body);
|
||||||
prm.childPrim = true;
|
prm.childPrim = true;
|
||||||
d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z);
|
d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z);
|
||||||
//d.GeomSetOffsetPosition(prim.prim_geom,
|
//d.GeomSetOffsetPosition(prim.prim_geom,
|
||||||
// (Position.X - prm.Position.X) - pMass.c.X,
|
// (Position.X - prm.Position.X) - pMass.c.X,
|
||||||
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
||||||
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
||||||
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
|
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
|
||||||
//d.GeomSetOffsetRotation(prm.prim_geom, ref mat);
|
//d.GeomSetOffsetRotation(prm.prim_geom, ref mat);
|
||||||
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||||
d.BodySetMass(Body, ref pMass);
|
d.BodySetMass(Body, ref pMass);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name);
|
m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
prm.m_interpenetrationcount = 0;
|
prm.m_interpenetrationcount = 0;
|
||||||
prm.m_collisionscore = 0;
|
prm.m_collisionscore = 0;
|
||||||
prm.m_disabled = false;
|
prm.m_disabled = false;
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
prm.createAMotor(m_angularlock);
|
prm.createAMotor(m_angularlock);
|
||||||
}
|
}
|
||||||
prm.Body = Body;
|
prm.Body = Body;
|
||||||
_parent_scene.ActivatePrim(prm);
|
_parent_scene.ActivatePrim(prm);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_collisionCategories |= CollisionCategories.Body;
|
m_collisionCategories |= CollisionCategories.Body;
|
||||||
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
||||||
|
|
||||||
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
|
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
|
||||||
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
|
||||||
//Console.WriteLine(" Post GeomSetCategoryBits 2");
|
//Console.WriteLine(" Post GeomSetCategoryBits 2");
|
||||||
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
|
||||||
|
|
||||||
d.Quaternion quat2 = new d.Quaternion();
|
d.Quaternion quat2 = new d.Quaternion();
|
||||||
quat2.W = _orientation.W;
|
quat2.W = _orientation.W;
|
||||||
quat2.X = _orientation.X;
|
quat2.X = _orientation.X;
|
||||||
quat2.Y = _orientation.Y;
|
quat2.Y = _orientation.Y;
|
||||||
quat2.Z = _orientation.Z;
|
quat2.Z = _orientation.Z;
|
||||||
|
|
||||||
d.Matrix3 mat2 = new d.Matrix3();
|
d.Matrix3 mat2 = new d.Matrix3();
|
||||||
d.RfromQ(out mat2, ref quat2);
|
d.RfromQ(out mat2, ref quat2);
|
||||||
d.GeomSetBody(prim_geom, Body);
|
d.GeomSetBody(prim_geom, Body);
|
||||||
d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
|
d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
|
||||||
//d.GeomSetOffsetPosition(prim.prim_geom,
|
//d.GeomSetOffsetPosition(prim.prim_geom,
|
||||||
// (Position.X - prm.Position.X) - pMass.c.X,
|
// (Position.X - prm.Position.X) - pMass.c.X,
|
||||||
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
||||||
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
||||||
//d.GeomSetOffsetRotation(prim_geom, ref mat2);
|
//d.GeomSetOffsetRotation(prim_geom, ref mat2);
|
||||||
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||||
d.BodySetMass(Body, ref pMass);
|
d.BodySetMass(Body, ref pMass);
|
||||||
|
|
||||||
d.BodySetAutoDisableFlag(Body, true);
|
d.BodySetAutoDisableFlag(Body, true);
|
||||||
d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
||||||
|
|
||||||
m_interpenetrationcount = 0;
|
m_interpenetrationcount = 0;
|
||||||
m_collisionscore = 0;
|
m_collisionscore = 0;
|
||||||
m_disabled = false;
|
m_disabled = false;
|
||||||
|
|
||||||
// The body doesn't already have a finite rotation mode set here
|
// The body doesn't already have a finite rotation mode set here
|
||||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||||
{
|
{
|
||||||
createAMotor(m_angularlock);
|
createAMotor(m_angularlock);
|
||||||
}
|
|
||||||
d.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
|
|
||||||
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
|
||||||
m_vehicle.Enable(Body, _parent_scene);
|
|
||||||
|
|
||||||
_parent_scene.ActivatePrim(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
|
||||||
|
|
||||||
|
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||||
|
m_vehicle.Enable(Body, _parent_scene);
|
||||||
|
|
||||||
|
_parent_scene.ActivatePrim(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChildSetGeom(OdePrim odePrim)
|
private void ChildSetGeom(OdePrim odePrim)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ODE PRIM]: ChildSetGeom {0} {1} for {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID);
|
||||||
|
|
||||||
//if (IsPhysical && Body != IntPtr.Zero)
|
//if (IsPhysical && Body != IntPtr.Zero)
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1192,12 +1196,14 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
//prm.childPrim = false;
|
//prm.childPrim = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disableBody();
|
disableBody();
|
||||||
|
|
||||||
if (Body != IntPtr.Zero)
|
// Spurious - Body == IntPtr.Zero after disableBody()
|
||||||
{
|
// if (Body != IntPtr.Zero)
|
||||||
_parent_scene.DeactivatePrim(this);
|
// {
|
||||||
}
|
// _parent_scene.DeactivatePrim(this);
|
||||||
|
// }
|
||||||
|
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1211,6 +1217,9 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
|
|
||||||
private void ChildDelink(OdePrim odePrim)
|
private void ChildDelink(OdePrim odePrim)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[ODE PRIM]: Delinking prim {0} {1} from {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID);
|
||||||
|
|
||||||
// Okay, we have a delinked child.. need to rebuild the body.
|
// Okay, we have a delinked child.. need to rebuild the body.
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
@ -1225,6 +1234,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
//prm.childPrim = false;
|
//prm.childPrim = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disableBody();
|
disableBody();
|
||||||
|
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
|
@ -1233,10 +1243,11 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
||||||
childrenPrim.Remove(odePrim);
|
childrenPrim.Remove(odePrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Body != IntPtr.Zero)
|
// Spurious - Body == IntPtr.Zero after disableBody()
|
||||||
{
|
// if (Body != IntPtr.Zero)
|
||||||
_parent_scene.DeactivatePrim(this);
|
// {
|
||||||
}
|
// _parent_scene.DeactivatePrim(this);
|
||||||
|
// }
|
||||||
|
|
||||||
lock (childrenPrim)
|
lock (childrenPrim)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2226,7 +2226,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// <param name="prim"></param>
|
/// <param name="prim"></param>
|
||||||
internal void RemovePrimThreadLocked(OdePrim prim)
|
internal void RemovePrimThreadLocked(OdePrim prim)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
|
// m_log.DebugFormat("[ODE SCENE]: Removing physical prim {0} {1}", prim.Name, prim.LocalID);
|
||||||
|
|
||||||
lock (prim)
|
lock (prim)
|
||||||
{
|
{
|
||||||
RemoveCollisionEventReporting(prim);
|
RemoveCollisionEventReporting(prim);
|
||||||
|
|
Loading…
Reference in New Issue