Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

slimupdates
Justin Clark-Casey (justincc) 2010-03-12 22:49:16 +00:00
commit 6828d8ecbe
18 changed files with 6198 additions and 5998 deletions

View File

@ -2044,6 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_lastColliders.Remove(localID); m_lastColliders.Remove(localID);
} }
if (m_parentGroup == null) if (m_parentGroup == null)
return; return;
if (m_parentGroup.IsDeleted) if (m_parentGroup.IsDeleted)

View File

@ -108,12 +108,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
private bool[] m_colliderarr = new bool[11]; private bool[] m_colliderarr = new bool[11];
private bool[] m_colliderGroundarr = new bool[11]; private bool[] m_colliderGroundarr = new bool[11];
private BulletDotNETScene m_parent_scene; private BulletDotNETScene m_parent_scene;
public int m_eventsubscription = 0; public int m_eventsubscription = 0;
// private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); private CollisionEventUpdate CollisionEventsThisFrame = null;
private int m_requestedUpdateFrequency = 0;
public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
{ {
@ -212,7 +211,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
m_mass = Mass; m_mass = Mass;
Body = new btRigidBody(m_mass, m_bodyMotionState, Shell); Body = new btRigidBody(m_mass, m_bodyMotionState, Shell);
Body.setUserPointer(new IntPtr((int)Body.Handle)); // this is used for self identification. User localID instead of body handle
Body.setUserPointer(new IntPtr((int)m_localID));
if (ClosestCastResult != null) if (ClosestCastResult != null)
ClosestCastResult.Dispose(); ClosestCastResult.Dispose();
@ -717,6 +717,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
public override void SubscribeEvents(int ms) public override void SubscribeEvents(int ms)
{ {
m_eventsubscription = ms; m_eventsubscription = ms;
m_requestedUpdateFrequency = ms;
m_parent_scene.addCollisionEventReporting(this); m_parent_scene.addCollisionEventReporting(this);
} }
@ -724,6 +725,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{ {
m_parent_scene.remCollisionEventReporting(this); m_parent_scene.remCollisionEventReporting(this);
m_eventsubscription = 0; m_eventsubscription = 0;
m_requestedUpdateFrequency = 0;
} }
public override bool SubscribedEvents() public override bool SubscribedEvents()
@ -733,6 +735,29 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
return false; return false;
} }
public void AddCollision(uint collideWith, ContactPoint contact)
{
if (CollisionEventsThisFrame == null)
{
CollisionEventsThisFrame = new CollisionEventUpdate();
}
CollisionEventsThisFrame.addCollider(collideWith, contact);
}
public void SendCollisions()
{
if (m_eventsubscription >= m_requestedUpdateFrequency)
{
if (CollisionEventsThisFrame != null)
{
base.SendCollisionUpdate(CollisionEventsThisFrame);
}
CollisionEventsThisFrame = new CollisionEventUpdate();
m_eventsubscription = 0;
}
return;
}
internal void Dispose() internal void Dispose()
{ {
if (Body.isInWorld()) if (Body.isInWorld())

View File

@ -154,7 +154,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
private Vector3 _target_velocity; private Vector3 _target_velocity;
public int m_eventsubscription; public int m_eventsubscription;
// private CollisionEventUpdate CollisionEventsThisFrame = null; private int m_requestedUpdateFrequency = 0;
private CollisionEventUpdate CollisionEventsThisFrame = null;
public volatile bool childPrim; public volatile bool childPrim;
@ -595,6 +596,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
public override void SubscribeEvents(int ms) public override void SubscribeEvents(int ms)
{ {
m_eventsubscription = ms; m_eventsubscription = ms;
m_requestedUpdateFrequency = ms;
_parent_scene.addCollisionEventReporting(this); _parent_scene.addCollisionEventReporting(this);
} }
@ -602,6 +604,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{ {
_parent_scene.remCollisionEventReporting(this); _parent_scene.remCollisionEventReporting(this);
m_eventsubscription = 0; m_eventsubscription = 0;
m_requestedUpdateFrequency = 0;
} }
public override bool SubscribedEvents() public override bool SubscribedEvents()
@ -611,7 +614,28 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
#endregion #endregion
public void AddCollision(uint collideWith, ContactPoint contact)
{
if (CollisionEventsThisFrame == null)
{
CollisionEventsThisFrame = new CollisionEventUpdate();
}
CollisionEventsThisFrame.addCollider(collideWith, contact);
}
public void SendCollisions()
{
if (m_eventsubscription >= m_requestedUpdateFrequency)
{
if (CollisionEventsThisFrame != null)
{
base.SendCollisionUpdate(CollisionEventsThisFrame);
}
CollisionEventsThisFrame = null;
// m_eventsubscription = 0;
}
return;
}
internal void Dispose() internal void Dispose()
{ {
@ -759,7 +783,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{ {
if (m_taintadd) if (m_taintadd)
{ {
m_log.Debug("[PHYSICS]: TaintAdd"); // m_log.Debug("[PHYSICS]: TaintAdd");
changeadd(timestep); changeadd(timestep);
} }
@ -771,7 +795,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
SetBody(Mass); SetBody(Mass);
else else
SetBody(0); SetBody(0);
m_log.Debug("[PHYSICS]: GEOM_DOESNT_EXSIT"); // m_log.Debug("[PHYSICS]: GEOM_DOESNT_EXSIT");
} }
if (prim_geom.Handle == IntPtr.Zero) if (prim_geom.Handle == IntPtr.Zero)
@ -782,31 +806,31 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
SetBody(Mass); SetBody(Mass);
else else
SetBody(0); SetBody(0);
m_log.Debug("[PHYSICS]: GEOM_DOESNT_EXSIT"); // m_log.Debug("[PHYSICS]: GEOM_DOESNT_EXSIT");
} }
if (!_position.ApproxEquals(m_taintposition, 0f)) if (!_position.ApproxEquals(m_taintposition, 0f))
{ {
m_log.Debug("[PHYSICS]: TaintMove"); // m_log.Debug("[PHYSICS]: TaintMove");
changemove(timestep); changemove(timestep);
} }
if (m_taintrot != _orientation) if (m_taintrot != _orientation)
{ {
m_log.Debug("[PHYSICS]: TaintRotate"); // m_log.Debug("[PHYSICS]: TaintRotate");
rotate(timestep); rotate(timestep);
} // } //
if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent)) if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent))
{ {
m_log.Debug("[PHYSICS]: TaintPhysics"); // m_log.Debug("[PHYSICS]: TaintPhysics");
changePhysicsStatus(timestep); changePhysicsStatus(timestep);
} }
// //
if (!_size.ApproxEquals(m_taintsize, 0f)) if (!_size.ApproxEquals(m_taintsize, 0f))
{ {
m_log.Debug("[PHYSICS]: TaintSize"); // m_log.Debug("[PHYSICS]: TaintSize");
changesize(timestep); changesize(timestep);
} }
@ -814,43 +838,43 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
if (m_taintshape) if (m_taintshape)
{ {
m_log.Debug("[PHYSICS]: TaintShape"); // m_log.Debug("[PHYSICS]: TaintShape");
changeshape(timestep); changeshape(timestep);
} // } //
if (m_taintforce) if (m_taintforce)
{ {
m_log.Debug("[PHYSICS]: TaintForce"); // m_log.Debug("[PHYSICS]: TaintForce");
changeAddForce(timestep); changeAddForce(timestep);
} }
if (m_taintaddangularforce) if (m_taintaddangularforce)
{ {
m_log.Debug("[PHYSICS]: TaintAngularForce"); // m_log.Debug("[PHYSICS]: TaintAngularForce");
changeAddAngularForce(timestep); changeAddAngularForce(timestep);
} }
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
{ {
m_log.Debug("[PHYSICS]: TaintTorque"); // m_log.Debug("[PHYSICS]: TaintTorque");
changeSetTorque(timestep); changeSetTorque(timestep);
} }
if (m_taintdisable) if (m_taintdisable)
{ {
m_log.Debug("[PHYSICS]: TaintDisable"); // m_log.Debug("[PHYSICS]: TaintDisable");
changedisable(timestep); changedisable(timestep);
} }
if (m_taintselected != m_isSelected) if (m_taintselected != m_isSelected)
{ {
m_log.Debug("[PHYSICS]: TaintSelected"); // m_log.Debug("[PHYSICS]: TaintSelected");
changeSelectedStatus(timestep); changeSelectedStatus(timestep);
} }
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
{ {
m_log.Debug("[PHYSICS]: TaintVelocity"); // m_log.Debug("[PHYSICS]: TaintVelocity");
changevelocity(timestep); changevelocity(timestep);
} }
if (m_taintparent != _parent) if (m_taintparent != _parent)
{ {
m_log.Debug("[PHYSICS]: TaintLink"); // m_log.Debug("[PHYSICS]: TaintLink");
changelink(timestep); changelink(timestep);
} }
if (m_taintCollidesWater != m_collidesWater) if (m_taintCollidesWater != m_collidesWater)
@ -859,7 +883,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
} }
if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0)) if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0))
{ {
m_log.Debug("[PHYSICS]: TaintAngularLock"); // m_log.Debug("[PHYSICS]: TaintAngularLock");
changeAngularLock(timestep); changeAngularLock(timestep);
} }
if (m_taintremove) if (m_taintremove)
@ -917,7 +941,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
private void changemove(float timestep) private void changemove(float timestep)
{ {
m_log.Debug("[PHYSICS]: _________ChangeMove"); // m_log.Debug("[PHYSICS]: _________ChangeMove");
if (!m_isphysical) if (!m_isphysical)
{ {
tempTransform2 = Body.getWorldTransform(); tempTransform2 = Body.getWorldTransform();
@ -977,7 +1001,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
private void rotate(float timestep) private void rotate(float timestep)
{ {
m_log.Debug("[PHYSICS]: _________ChangeRotate"); // m_log.Debug("[PHYSICS]: _________ChangeRotate");
tempTransform2 = Body.getWorldTransform(); tempTransform2 = Body.getWorldTransform();
tempOrientation2 = new btQuaternion(_orientation.X, _orientation.Y, _orientation.Z, _orientation.W); tempOrientation2 = new btQuaternion(_orientation.X, _orientation.Y, _orientation.Z, _orientation.W);
tempTransform2.setRotation(tempOrientation2); tempTransform2.setRotation(tempOrientation2);
@ -1000,7 +1024,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
//Body = null; //Body = null;
// TODO: dispose parts that make up body // TODO: dispose parts that make up body
} }
m_log.Debug("[PHYSICS]: _________ChangePhysics"); // m_log.Debug("[PHYSICS]: _________ChangePhysics");
ProcessGeomCreation(); ProcessGeomCreation();
@ -1092,7 +1116,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
// TODO: dispose parts that make up body // TODO: dispose parts that make up body
} }
m_log.Debug("[PHYSICS]: _________ChangeSize"); // m_log.Debug("[PHYSICS]: _________ChangeSize");
SetCollisionShape(null); SetCollisionShape(null);
// Construction of new prim // Construction of new prim
ProcessGeomCreation(); ProcessGeomCreation();
@ -1297,13 +1321,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
// TODO: throw new NotImplementedException(); // TODO: throw new NotImplementedException();
if (m_taintselected) if (m_taintselected)
{ {
Body.setCollisionFlags((int)ContactFlags.CF_NO_CONTACT_RESPONSE); // Body.setCollisionFlags((int)ContactFlags.CF_NO_CONTACT_RESPONSE);
disableBodySoft(); disableBodySoft();
} }
else else
{ {
Body.setCollisionFlags(0 | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK); // Body.setCollisionFlags(0 | (int)ContactFlags.CF_CUSTOM_MATERIAL_CALLBACK);
enableBodySoft(); enableBodySoft();
} }
m_isSelected = m_taintselected; m_isSelected = m_taintselected;
@ -1605,6 +1629,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
enableBodySoft(); enableBodySoft();
} }
*/ */
if (!Body.isActive())
{
Body.clearForces();
enableBodySoft();
}
// 35x10 = 350n times the mass per second applied maximum. // 35x10 = 350n times the mass per second applied maximum.
float nmax = 35f * m_mass; float nmax = 35f * m_mass;
@ -1632,6 +1661,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
Body.applyCentralImpulse(tempAddForce); Body.applyCentralImpulse(tempAddForce);
} }
} }
else
{
// if no forces on the prim, make sure everything is zero
Body.clearForces();
enableBodySoft();
}
} }
else else
{ {
@ -1985,7 +2020,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
public void CreateGeom(IntPtr m_targetSpace, IMesh p_mesh) public void CreateGeom(IntPtr m_targetSpace, IMesh p_mesh)
{ {
m_log.Debug("[PHYSICS]: _________CreateGeom"); // m_log.Debug("[PHYSICS]: _________CreateGeom");
if (p_mesh != null) if (p_mesh != null)
{ {
//_mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); //_mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
@ -2042,7 +2077,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
// TODO: Set Collision Body Mesh // TODO: Set Collision Body Mesh
// This sleeper is there to moderate how long it takes between // This sleeper is there to moderate how long it takes between
// setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object
m_log.Debug("_________SetMesh"); // m_log.Debug("_________SetMesh");
Thread.Sleep(10); Thread.Sleep(10);
//Kill Body so that mesh can re-make the geom //Kill Body so that mesh can re-make the geom
@ -2159,7 +2194,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
// Body = new btRigidBody(mass, tempMotionState1, prim_geom); // Body = new btRigidBody(mass, tempMotionState1, prim_geom);
//else //else
// Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1);
if (Body == null)
{
Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1); Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1);
// add localID so we can later map bullet object back to OpenSim object
Body.setUserPointer(new IntPtr((int)m_localID));
}
if (prim_geom is btGImpactMeshShape) if (prim_geom is btGImpactMeshShape)
{ {
@ -2250,7 +2292,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
// Body = new btRigidBody(mass, tempMotionState1, prim_geom); // Body = new btRigidBody(mass, tempMotionState1, prim_geom);
//else //else
// Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1);
if (Body == null)
{
Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1); Body = new btRigidBody(mass, tempMotionState1, prim_geom, tempInertia1);
// each body has the localID stored into it so we can identify collision objects
Body.setUserPointer(new IntPtr((int)m_localID));
}
if (prim_geom is btGImpactMeshShape) if (prim_geom is btGImpactMeshShape)
{ {

View File

@ -47,7 +47,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
// private string m_sceneIdentifier = string.Empty; // private string m_sceneIdentifier = string.Empty;
private List<BulletDotNETCharacter> m_characters = new List<BulletDotNETCharacter>(); private List<BulletDotNETCharacter> m_characters = new List<BulletDotNETCharacter>();
private Dictionary<uint, BulletDotNETCharacter> m_charactersLocalID = new Dictionary<uint, BulletDotNETCharacter>();
private List<BulletDotNETPrim> m_prims = new List<BulletDotNETPrim>(); private List<BulletDotNETPrim> m_prims = new List<BulletDotNETPrim>();
private Dictionary<uint, BulletDotNETPrim> m_primsLocalID = new Dictionary<uint, BulletDotNETPrim>();
private List<BulletDotNETPrim> m_activePrims = new List<BulletDotNETPrim>(); private List<BulletDotNETPrim> m_activePrims = new List<BulletDotNETPrim>();
private List<PhysicsActor> m_taintedActors = new List<PhysicsActor>(); private List<PhysicsActor> m_taintedActors = new List<PhysicsActor>();
private btDiscreteDynamicsWorld m_world; private btDiscreteDynamicsWorld m_world;
@ -134,7 +136,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration); m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
m_world = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration); m_world = new btDiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration);
m_world.setGravity(m_gravity); m_world.setGravity(m_gravity);
//EnableCollisionInterface(); EnableCollisionInterface();
} }
@ -145,7 +147,16 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
avCapRadius, avStandupTensor, avDensity, avCapRadius, avStandupTensor, avDensity,
avHeightFudgeFactor, avMovementDivisorWalk, avHeightFudgeFactor, avMovementDivisorWalk,
avMovementDivisorRun); avMovementDivisorRun);
try
{
m_characters.Add(chr); m_characters.Add(chr);
m_charactersLocalID.Add(chr.m_localID, chr);
}
catch
{
// noop if it's already there
m_log.Debug("[PHYSICS] BulletDotNet: adding duplicate avatar localID");
}
AddPhysicsActorTaint(chr); AddPhysicsActorTaint(chr);
return chr; return chr;
} }
@ -154,6 +165,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{ {
BulletDotNETCharacter chr = (BulletDotNETCharacter) actor; BulletDotNETCharacter chr = (BulletDotNETCharacter) actor;
m_charactersLocalID.Remove(chr.m_localID);
m_characters.Remove(chr); m_characters.Remove(chr);
m_world.removeRigidBody(chr.Body); m_world.removeRigidBody(chr.Body);
m_world.removeCollisionObject(chr.Body); m_world.removeCollisionObject(chr.Body);
@ -279,7 +291,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
prim.Move(timeStep); prim.Move(timeStep);
} }
} }
float steps = m_world.stepSimulation(timeStep * 1000, 10, WorldTimeComp); float steps = m_world.stepSimulation(timeStep, 10, WorldTimeComp);
foreach (BulletDotNETCharacter chr in m_characters) foreach (BulletDotNETCharacter chr in m_characters)
{ {
@ -296,20 +308,67 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
} }
if (m_CollisionInterface != null) if (m_CollisionInterface != null)
{ {
List<int> collisions = m_CollisionInterface.GetContactList(); List<BulletDotNETPrim> primsWithCollisions = new List<BulletDotNETPrim>();
lock (collisions) List<BulletDotNETCharacter> charactersWithCollisions = new List<BulletDotNETCharacter>();
// get the collisions that happened this tick
List<BulletDotNET.ContactAddedCallbackHandler.ContactInfo> collisions = m_CollisionInterface.GetContactList();
// passed back the localID of the prim so we can associate the prim
foreach (BulletDotNET.ContactAddedCallbackHandler.ContactInfo ci in collisions)
{ {
foreach (int pvalue in collisions) // ContactPoint = { contactPoint, contactNormal, penetrationDepth }
{ ContactPoint contact = new ContactPoint(new Vector3(ci.pX, ci.pY, ci.pZ),
System.Console.Write(string.Format("{0} ", pvalue)); new Vector3(ci.nX, ci.nY, ci.nZ), ci.depth);
}
} ProcessContact(ci.contact, ci.contactWith, contact, ref primsWithCollisions, ref charactersWithCollisions);
m_CollisionInterface.Clear(); ProcessContact(ci.contactWith, ci.contact, contact, ref primsWithCollisions, ref charactersWithCollisions);
} }
m_CollisionInterface.Clear();
// for those prims and characters that had collisions cause collision events
foreach (BulletDotNETPrim bdnp in primsWithCollisions)
{
bdnp.SendCollisions();
}
foreach (BulletDotNETCharacter bdnc in charactersWithCollisions)
{
bdnc.SendCollisions();
}
}
return steps; return steps;
} }
private void ProcessContact(uint cont, uint contWith, ContactPoint contact,
ref List<BulletDotNETPrim> primsWithCollisions,
ref List<BulletDotNETCharacter> charactersWithCollisions)
{
BulletDotNETPrim bdnp;
// collisions with a normal prim?
if (m_primsLocalID.TryGetValue(cont, out bdnp))
{
// Added collision event to the prim. This creates a pile of events
// that will be sent to any subscribed listeners.
bdnp.AddCollision(contWith, contact);
if (!primsWithCollisions.Contains(bdnp))
{
primsWithCollisions.Add(bdnp);
}
}
else
{
BulletDotNETCharacter bdnc;
// if not a prim, maybe it's one of the characters
if (m_charactersLocalID.TryGetValue(cont, out bdnc))
{
bdnc.AddCollision(contWith, contact);
if (!charactersWithCollisions.Contains(bdnc))
{
charactersWithCollisions.Add(bdnc);
}
}
}
}
public override void GetResults() public override void GetResults()
{ {
@ -387,6 +446,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
m_terrainTransform = new btTransform(QuatIdentity, m_terrainPosition); m_terrainTransform = new btTransform(QuatIdentity, m_terrainPosition);
m_terrainMotionState = new btDefaultMotionState(m_terrainTransform); m_terrainMotionState = new btDefaultMotionState(m_terrainTransform);
TerrainBody = new btRigidBody(0, m_terrainMotionState, m_terrainShape); TerrainBody = new btRigidBody(0, m_terrainMotionState, m_terrainShape);
TerrainBody.setUserPointer((IntPtr)0);
m_world.addRigidBody(TerrainBody); m_world.addRigidBody(TerrainBody);
@ -459,6 +519,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{ {
lock (m_prims) lock (m_prims)
{ {
m_primsLocalID.Clear();
foreach (BulletDotNETPrim prim in m_prims) foreach (BulletDotNETPrim prim in m_prims)
{ {
if (prim.Body != null) if (prim.Body != null)
@ -513,6 +574,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
m_world.removeRigidBody(body); m_world.removeRigidBody(body);
} }
remActivePrim(prm); remActivePrim(prm);
m_primsLocalID.Remove(prm.m_localID);
m_prims.Remove(prm); m_prims.Remove(prm);
} }
@ -685,10 +747,19 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
lock (m_prims) lock (m_prims)
{ {
if (!m_prims.Contains(pPrim)) if (!m_prims.Contains(pPrim))
{
try
{ {
m_prims.Add(pPrim); m_prims.Add(pPrim);
m_primsLocalID.Add(pPrim.m_localID, pPrim);
}
catch
{
// noop if it's already there
m_log.Debug("[PHYSICS] BulletDotNet: adding duplicate prim localID");
}
m_world.addRigidBody(pPrim.Body); m_world.addRigidBody(pPrim.Body);
m_log.Debug("ADDED"); // m_log.Debug("[PHYSICS] added prim to scene");
} }
} }
} }
@ -696,8 +767,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
{ {
if (m_CollisionInterface == null) if (m_CollisionInterface == null)
{ {
m_CollisionInterface = new ContactAddedCallbackHandler(); m_CollisionInterface = new ContactAddedCallbackHandler(m_world);
m_world.SetCollisionAddedCallback(m_CollisionInterface); // m_world.SetCollisionAddedCallback(m_CollisionInterface);
} }
} }

View File

@ -1575,11 +1575,11 @@ Console.WriteLine(" JointCreateFixed");
{ {
//Console.WriteLine("Move " + m_primName); //Console.WriteLine("Move " + m_primName);
if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
/*
// NON-'VEHICLES' are dealt with here // NON-'VEHICLES' are dealt with here
if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
{ {
d.Vector3 avel2 = d.BodyGetAngularVel(Body); d.Vector3 avel2 = d.BodyGetAngularVel(Body);
/*
if (m_angularlock.X == 1) if (m_angularlock.X == 1)
avel2.X = 0; avel2.X = 0;
if (m_angularlock.Y == 1) if (m_angularlock.Y == 1)
@ -1587,8 +1587,8 @@ Console.WriteLine(" JointCreateFixed");
if (m_angularlock.Z == 1) if (m_angularlock.Z == 1)
avel2.Z = 0; avel2.Z = 0;
d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z);
}
*/ */
}
//float PID_P = 900.0f; //float PID_P = 900.0f;
float m_mass = CalculateMass(); float m_mass = CalculateMass();

View File

@ -84,6 +84,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "AssetServices"))
{ {
IConfig gridConfig = source.Configs["AssetService"]; IConfig gridConfig = source.Configs["AssetService"];
if (gridConfig == null) if (gridConfig == null)
@ -95,15 +97,16 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceUrl = gridConfig.GetString("AssetServerURI"); string serviceUrl = gridConfig.GetString("AssetServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Info("[ASSET CONNECTOR]: No AssetServerURI in section AssetService, skipping SimianAssetServiceConnector"); m_log.Error("[ASSET CONNECTOR]: No AssetServerURI in section AssetService");
return; throw new Exception("Asset connector init error");
} }
if (!serviceUrl.EndsWith("/")) if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
serviceUrl = serviceUrl + '/'; serviceUrl = serviceUrl + '/';
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
} }
}
#region IAssetService #region IAssetService

View File

@ -72,6 +72,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "AuthenticationServices"))
{ {
IConfig assetConfig = source.Configs["AuthenticationService"]; IConfig assetConfig = source.Configs["AuthenticationService"];
if (assetConfig == null) if (assetConfig == null)
@ -83,12 +85,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceURI = assetConfig.GetString("AuthenticationServerURI"); string serviceURI = assetConfig.GetString("AuthenticationServerURI");
if (String.IsNullOrEmpty(serviceURI)) if (String.IsNullOrEmpty(serviceURI))
{ {
m_log.Info("[AUTH CONNECTOR]: No Server URI named in section AuthenticationService, skipping SimianAuthenticationServiceConnector"); m_log.Error("[AUTH CONNECTOR]: No Server URI named in section AuthenticationService");
return; throw new Exception("Authentication connector init error");
} }
m_serverUrl = serviceURI; m_serverUrl = serviceURI;
} }
}
public string Authenticate(UUID principalID, string password, int lifetime) public string Authenticate(UUID principalID, string password, int lifetime)
{ {

View File

@ -77,6 +77,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "AvatarServices"))
{ {
IConfig gridConfig = source.Configs["AvatarService"]; IConfig gridConfig = source.Configs["AvatarService"];
if (gridConfig == null) if (gridConfig == null)
@ -88,8 +90,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceUrl = gridConfig.GetString("AvatarServerURI"); string serviceUrl = gridConfig.GetString("AvatarServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Info("[AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService, skipping SimianAvatarServiceConnector"); m_log.Error("[AVATAR CONNECTOR]: No AvatarServerURI in section AvatarService");
return; throw new Exception("Avatar connector init error");
} }
if (!serviceUrl.EndsWith("/")) if (!serviceUrl.EndsWith("/"))
@ -97,6 +99,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
} }
}
#region IAvatarService #region IAvatarService

View File

@ -75,6 +75,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "FriendsServices"))
{ {
IConfig assetConfig = source.Configs["FriendsService"]; IConfig assetConfig = source.Configs["FriendsService"];
if (assetConfig == null) if (assetConfig == null)
@ -86,12 +88,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceURI = assetConfig.GetString("FriendsServerURI"); string serviceURI = assetConfig.GetString("FriendsServerURI");
if (String.IsNullOrEmpty(serviceURI)) if (String.IsNullOrEmpty(serviceURI))
{ {
m_log.Info("[FRIENDS CONNECTOR]: No Server URI named in section FriendsService, skipping SimianFriendsServiceConnector"); m_log.Error("[FRIENDS CONNECTOR]: No Server URI named in section FriendsService");
return; throw new Exception("Friends connector init error");
} }
m_serverUrl = serviceURI; m_serverUrl = serviceURI;
} }
}
#region IFriendsService #region IFriendsService

View File

@ -25,7 +25,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using Mono.Addins; using Mono.Addins;
using Nini.Config;
[assembly: Addin("SimianGrid", "1.0")] [assembly: Addin("SimianGrid", "1.0")]
[assembly: AddinDependency("OpenSim", "0.5")] [assembly: AddinDependency("OpenSim", "0.5")]
public static class Simian
{
public static bool IsSimianEnabled(IConfigSource config, string moduleName)
{
if (config.Configs["Modules"] != null)
{
string module = config.Configs["Modules"].GetString("AuthenticationServices");
return !String.IsNullOrEmpty(module) && module.Contains("Simian");
}
return false;
}
}

View File

@ -79,6 +79,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "GridServices"))
{ {
IConfig gridConfig = source.Configs["GridService"]; IConfig gridConfig = source.Configs["GridService"];
if (gridConfig == null) if (gridConfig == null)
@ -90,12 +92,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceUrl = gridConfig.GetString("GridServerURI"); string serviceUrl = gridConfig.GetString("GridServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Info("[GRID CONNECTOR]: No Server URI named in section GridService, skipping SimianGridServiceConnector"); m_log.Error("[GRID CONNECTOR]: No Server URI named in section GridService");
return; throw new Exception("Grid connector init error");
} }
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
} }
}
#region IGridService #region IGridService

View File

@ -91,6 +91,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "InventoryServices"))
{ {
IConfig gridConfig = source.Configs["InventoryService"]; IConfig gridConfig = source.Configs["InventoryService"];
if (gridConfig == null) if (gridConfig == null)
@ -102,13 +104,26 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceUrl = gridConfig.GetString("InventoryServerURI"); string serviceUrl = gridConfig.GetString("InventoryServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Info("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService, skipping SimianInventoryServiceConnector"); m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
return; throw new Exception("Inventory connector init error");
} }
// FIXME: Get the user server URL too
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
gridConfig = source.Configs["UserAccountService"];
if (gridConfig != null)
{
serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (!String.IsNullOrEmpty(serviceUrl))
m_userServerUrl = serviceUrl;
else
m_log.Info("[INVENTORY CONNECTOR]: No Server URI named in section UserAccountService");
}
else
{
m_log.Warn("[INVENTORY CONNECTOR]: UserAccountService missing from OpenSim.ini");
}
}
} }
/// <summary> /// <summary>

View File

@ -103,6 +103,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "PresenceServices"))
{ {
IConfig gridConfig = source.Configs["PresenceService"]; IConfig gridConfig = source.Configs["PresenceService"];
if (gridConfig == null) if (gridConfig == null)
@ -114,12 +116,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceUrl = gridConfig.GetString("PresenceServerURI"); string serviceUrl = gridConfig.GetString("PresenceServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Info("[PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService, skipping SimianPresenceServiceConnector"); m_log.Error("[PRESENCE CONNECTOR]: No PresenceServerURI in section PresenceService");
return; throw new Exception("Presence connector init error");
} }
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
} }
}
#region IPresenceService #region IPresenceService

View File

@ -87,6 +87,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "UserAccountServices"))
{ {
IConfig gridConfig = source.Configs["UserAccountService"]; IConfig gridConfig = source.Configs["UserAccountService"];
if (gridConfig == null) if (gridConfig == null)
@ -98,8 +100,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceUrl = gridConfig.GetString("UserAccountServerURI"); string serviceUrl = gridConfig.GetString("UserAccountServerURI");
if (String.IsNullOrEmpty(serviceUrl)) if (String.IsNullOrEmpty(serviceUrl))
{ {
m_log.Info("[PROFILES]: No UserAccountServerURI in section UserAccountService, skipping SimianProfiles"); m_log.Error("[PROFILES]: No UserAccountServerURI in section UserAccountService");
return; throw new Exception("Profiles init error");
} }
if (!serviceUrl.EndsWith("/")) if (!serviceUrl.EndsWith("/"))
@ -107,6 +109,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_serverUrl = serviceUrl; m_serverUrl = serviceUrl;
} }
}
private void ClientConnectHandler(IClientCore clientCore) private void ClientConnectHandler(IClientCore clientCore)
{ {

View File

@ -76,6 +76,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{
if (Simian.IsSimianEnabled(source, "UserAccountServices"))
{ {
IConfig assetConfig = source.Configs["UserAccountService"]; IConfig assetConfig = source.Configs["UserAccountService"];
if (assetConfig == null) if (assetConfig == null)
@ -87,13 +89,14 @@ namespace OpenSim.Services.Connectors.SimianGrid
string serviceURI = assetConfig.GetString("UserAccountServerURI"); string serviceURI = assetConfig.GetString("UserAccountServerURI");
if (String.IsNullOrEmpty(serviceURI)) if (String.IsNullOrEmpty(serviceURI))
{ {
m_log.Info("[ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector"); m_log.Error("[ACCOUNT CONNECTOR]: No UserAccountServerURI in section UserAccountService, skipping SimianUserAccountServiceConnector");
return; throw new Exception("User account connector init error");
} }
m_accountCache = new ExpiringCache<UUID, UserAccount>(); m_accountCache = new ExpiringCache<UUID, UserAccount>();
m_serverUrl = serviceURI; m_serverUrl = serviceURI;
} }
}
public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
{ {

Binary file not shown.

Binary file not shown.