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

0.7.6-extended
Justin Clark-Casey (justincc) 2013-08-14 23:21:51 +01:00
commit 73e3ca670d
5 changed files with 28 additions and 6 deletions

View File

@ -69,7 +69,9 @@ public class BSActorAvatarMove : BSActor
// BSActor.Dispose() // BSActor.Dispose()
public override void Dispose() public override void Dispose()
{ {
Enabled = false; base.SetEnabled(false);
// Now that turned off, remove any state we have in the scene.
Refresh();
} }
// Called when physical parameters (properties set in Bullet) need to be re-applied. // Called when physical parameters (properties set in Bullet) need to be re-applied.
@ -181,7 +183,7 @@ public class BSActorAvatarMove : BSActor
if (m_controllingPrim.IsColliding) if (m_controllingPrim.IsColliding)
{ {
// If we are colliding with a stationary object, presume we're standing and don't move around // If we are colliding with a stationary object, presume we're standing and don't move around
if (!m_controllingPrim.ColliderIsMoving) if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect)
{ {
m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID);
m_controllingPrim.IsStationary = true; m_controllingPrim.IsStationary = true;

View File

@ -107,6 +107,8 @@ public sealed class BSCharacter : BSPhysObject
PhysicalActors.Add(AvatarMoveActorName, m_moveActor); PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
SetPhysicalProperties(); SetPhysicalProperties();
IsInitialized = true;
}); });
return; return;
} }
@ -114,6 +116,8 @@ public sealed class BSCharacter : BSPhysObject
// called when this character is being destroyed and the resources should be released // called when this character is being destroyed and the resources should be released
public override void Destroy() public override void Destroy()
{ {
IsInitialized = false;
base.Destroy(); base.Destroy();
DetailLog("{0},BSCharacter.Destroy", LocalID); DetailLog("{0},BSCharacter.Destroy", LocalID);

View File

@ -72,6 +72,8 @@ public abstract class BSPhysObject : PhysicsActor
} }
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName) protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{ {
IsInitialized = false;
PhysScene = parentScene; PhysScene = parentScene;
LocalID = localID; LocalID = localID;
PhysObjectName = name; PhysObjectName = name;
@ -130,6 +132,9 @@ public abstract class BSPhysObject : PhysicsActor
public string PhysObjectName { get; protected set; } public string PhysObjectName { get; protected set; }
public string TypeName { get; protected set; } public string TypeName { get; protected set; }
// Set to 'true' when the object is completely initialized.
// This mostly prevents property updates and collisions until the object is completely here.
public bool IsInitialized { get; protected set; }
// Return the object mass without calculating it or having side effects // Return the object mass without calculating it or having side effects
public abstract float RawMass { get; } public abstract float RawMass { get; }
@ -352,6 +357,8 @@ public abstract class BSPhysObject : PhysicsActor
// On a collision, check the collider and remember if the last collider was moving // On a collision, check the collider and remember if the last collider was moving
// Used to modify the standing of avatars (avatars on stationary things stand still) // Used to modify the standing of avatars (avatars on stationary things stand still)
public bool ColliderIsMoving; public bool ColliderIsMoving;
// 'true' if the last collider was a volume detect object
public bool ColliderIsVolumeDetect;
// Used by BSCharacter to manage standing (and not slipping) // Used by BSCharacter to manage standing (and not slipping)
public bool IsStationary; public bool IsStationary;
@ -431,6 +438,7 @@ public abstract class BSPhysObject : PhysicsActor
// For movement tests, remember if we are colliding with an object that is moving. // For movement tests, remember if we are colliding with an object that is moving.
ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false; ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false;
ColliderIsVolumeDetect = collidee != null ? (collidee.IsVolumeDetect) : false;
// Make a collection of the collisions that happened the last simulation tick. // Make a collection of the collisions that happened the last simulation tick.
// This is different than the collection created for sending up to the simulator as it is cleared every tick. // This is different than the collection created for sending up to the simulator as it is cleared every tick.

View File

@ -110,6 +110,8 @@ public class BSPrim : BSPhysObject
CreateGeomAndObject(true); CreateGeomAndObject(true);
CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody); CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody);
IsInitialized = true;
}); });
} }
@ -117,6 +119,8 @@ public class BSPrim : BSPhysObject
public override void Destroy() public override void Destroy()
{ {
// m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID); // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
IsInitialized = false;
base.Destroy(); base.Destroy();
// Undo any vehicle properties // Undo any vehicle properties

View File

@ -639,7 +639,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
BSPhysObject pobj; BSPhysObject pobj;
if (PhysObjects.TryGetValue(entprop.ID, out pobj)) if (PhysObjects.TryGetValue(entprop.ID, out pobj))
{ {
pobj.UpdateProperties(entprop); if (pobj.IsInitialized)
pobj.UpdateProperties(entprop);
} }
} }
} }
@ -766,10 +767,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) if (collider.IsInitialized)
{ {
// If a collision was 'good', remember to send it to the simulator if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
ObjectsWithCollisions.Add(collider); {
// If a collision was 'good', remember to send it to the simulator
ObjectsWithCollisions.Add(collider);
}
} }
return; return;