Revert "BulletSim: delay adding a scene presence to the list of presences"

Remove these changes until the region crossing problems can be figured out.

This reverts commit 062ec0efbd.
0.8.2-post-fixes
Robert Adams 2015-08-24 06:39:06 -07:00
parent 062ec0efbd
commit 9a490ad2b9
3 changed files with 19 additions and 33 deletions

View File

@ -75,10 +75,9 @@ public sealed class BSCharacter : BSPhysObject
// Avatars are always complete (in the physics engine sense) // Avatars are always complete (in the physics engine sense)
public override bool IsIncomplete { get { return false; } } public override bool IsIncomplete { get { return false; } }
// 'activate' is called with this character after all initialization is complete
public BSCharacter( public BSCharacter(
uint localID, String avName, BSScene parent_scene, uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 vel, OMV.Vector3 size, bool isFlying)
OMV.Vector3 pos, OMV.Vector3 vel, OMV.Vector3 size, bool isFlying, Action<BSCharacter> activate)
: base(parent_scene, localID, avName, "BSCharacter") : base(parent_scene, localID, avName, "BSCharacter")
{ {
_physicsActorType = (int)ActorTypes.Agent; _physicsActorType = (int)ActorTypes.Agent;
@ -125,9 +124,6 @@ public sealed class BSCharacter : BSPhysObject
SetPhysicalProperties(); SetPhysicalProperties();
IsInitialized = true; IsInitialized = true;
if (activate != null)
activate(this);
}); });
return; return;
} }
@ -476,13 +472,12 @@ public sealed class BSCharacter : BSPhysObject
} }
} }
// Force the setting of velocity. Called at taint time.
// Exists so that setting force by anyone can be overridden by a subcless.
public override OMV.Vector3 ForceVelocity { public override OMV.Vector3 ForceVelocity {
get { return RawVelocity; } get { return RawVelocity; }
set { set {
PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
DetailLog("{0},BSCharacter.setForceVelocity,call,vel={1}", LocalID, value); // Util.PrintCallStack();
DetailLog("{0}: set ForceVelocity = {1}", LocalID, value);
RawVelocity = value; RawVelocity = value;
PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);

View File

@ -71,11 +71,6 @@ 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)
{
InitializePhysObject(parentScene, localID, name, typeName);
}
protected void InitializePhysObject(BSScene parentScene, uint localID, string name, string typeName)
{ {
IsInitialized = false; IsInitialized = false;
@ -124,8 +119,6 @@ public abstract class BSPhysObject : PhysicsActor
// Tell the object to clean up. // Tell the object to clean up.
public virtual void Destroy() public virtual void Destroy()
{ {
SubscribedEventsMs = 0;
PhysicalActors.Enable(false); PhysicalActors.Enable(false);
PhysScene.TaintedObject(LocalID, "BSPhysObject.Destroy", delegate() PhysScene.TaintedObject(LocalID, "BSPhysObject.Destroy", delegate()
{ {
@ -462,7 +455,6 @@ public abstract class BSPhysObject : PhysicsActor
// Return 'true' if a collision was processed and should be sent up. // Return 'true' if a collision was processed and should be sent up.
// Return 'false' if this object is not enabled/subscribed/appropriate for or has already seen this collision. // Return 'false' if this object is not enabled/subscribed/appropriate for or has already seen this collision.
// Called at taint time from within the Step() function // Called at taint time from within the Step() function
// Both 'CollisionLock' and 'PhysObjects' are locked when this is called by 'SendCollisions'.
public delegate bool CollideCall(uint collidingWith, BSPhysObject collidee, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth); public delegate bool CollideCall(uint collidingWith, BSPhysObject collidee, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth);
public virtual bool Collide(uint collidingWith, BSPhysObject collidee, public virtual bool Collide(uint collidingWith, BSPhysObject collidee,
OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
@ -553,7 +545,7 @@ public abstract class BSPhysObject : PhysicsActor
// Subscribe for collision events. // Subscribe for collision events.
// Parameter is the millisecond rate the caller wishes collision events to occur. // Parameter is the millisecond rate the caller wishes collision events to occur.
public override void SubscribeEvents(int ms) { public override void SubscribeEvents(int ms) {
DetailLog("{0},{1}.SubscribeEvents,subscribing,ms={2}", LocalID, TypeName, ms); // DetailLog("{0},{1}.SubscribeEvents,subscribing,ms={2}", LocalID, TypeName, ms);
SubscribedEventsMs = ms; SubscribedEventsMs = ms;
if (ms > 0) if (ms > 0)
{ {

View File

@ -477,19 +477,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
if (!m_initialized) return null; if (!m_initialized) return null;
BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying, BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying);
(aa) =>
{
// While the actor exists, don't add it to the active avatar lists until completely initialized
lock (PhysObjects) lock (PhysObjects)
PhysObjects.Add(localID, aa); PhysObjects.Add(localID, actor);
// TODO: Remove kludge someday. // TODO: Remove kludge someday.
// We must generate a collision for avatars whether they collide or not. // We must generate a collision for avatars whether they collide or not.
// This is required by OpenSim to update avatar animations, etc. // This is required by OpenSim to update avatar animations, etc.
lock (AvatarsInSceneLock) lock (AvatarsInSceneLock)
AvatarsInScene.Add(aa); AvatarsInScene.Add(actor);
});
return actor; return actor;
} }
@ -833,10 +830,12 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
{ {
// If a collision was 'good', remember to send it to the simulator // If a collision was 'good', remember to send it to the simulator
// Note that 'CollisionLock' was locked before the call to 'SendCollsions' lock (CollisionLock)
{
ObjectsWithCollisions.Add(collider); ObjectsWithCollisions.Add(collider);
} }
} }
}
return; return;
} }