mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
* Added a better check to the SimianGrid connectors to test if they are enabled or not. This method should work equally well with standalone or robust mode
* Applying #4602 from Misterblu to add collision detection to BulletDotNET
This commit is contained in:
@@ -108,12 +108,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
private bool[] m_colliderarr = new bool[11];
|
||||
private bool[] m_colliderGroundarr = new bool[11];
|
||||
|
||||
|
||||
|
||||
private BulletDotNETScene m_parent_scene;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -212,7 +211,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
m_mass = Mass;
|
||||
|
||||
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)
|
||||
ClosestCastResult.Dispose();
|
||||
@@ -717,6 +717,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
m_eventsubscription = ms;
|
||||
m_requestedUpdateFrequency = ms;
|
||||
m_parent_scene.addCollisionEventReporting(this);
|
||||
}
|
||||
|
||||
@@ -724,6 +725,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
{
|
||||
m_parent_scene.remCollisionEventReporting(this);
|
||||
m_eventsubscription = 0;
|
||||
m_requestedUpdateFrequency = 0;
|
||||
}
|
||||
|
||||
public override bool SubscribedEvents()
|
||||
@@ -733,6 +735,29 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
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()
|
||||
{
|
||||
if (Body.isInWorld())
|
||||
|
||||
Reference in New Issue
Block a user