This started as way to correct Mantis #3158, which I believe should be fixed now. The flying status was temporarily being ignored, which caused the avie to drop sometimes -- there was a race condition. In the process it also fixes that annoying bug in basic physics where the avie would drop half-way to the ground upon region crossings (SetAppearance was missing). Additionally, a lot of child-agent-related code has been cleaned up; namely child agents are now consistently not added to physical scenes, and they also don't have appearances. All of that happens in MakeRoot, consistently.

0.6.3-post-fixes
diva 2009-02-15 05:00:58 +00:00
parent 7731c055e4
commit 3d5a9e6748
9 changed files with 47 additions and 37 deletions

View File

@ -2090,8 +2090,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{ {
AvatarAppearance appearance = null; AvatarAppearance appearance = new AvatarAppearance();
GetAvatarAppearance(client, out appearance); //GetAvatarAppearance(client, out appearance);
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
//avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
@ -2339,7 +2339,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Don't disable this log message - it's too helpful // Don't disable this log message - it's too helpful
m_log.DebugFormat( m_log.InfoFormat(
"[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})",
RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode);
@ -3295,7 +3295,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Info("[BUG]: " + e.ToString()); m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString());
} }
} }
} }

View File

@ -646,7 +646,7 @@ namespace OpenSim.Region.Framework.Scenes
else else
{ {
m_numRootAgents++; m_numRootAgents++;
presence.AddToPhysicalScene(); presence.AddToPhysicalScene(false);
} }
Entities[presence.UUID] = presence; Entities[presence.UUID] = presence;

View File

@ -611,7 +611,7 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.OnRequestWearables += SendWearables; m_controllingClient.OnRequestWearables += SendWearables;
m_controllingClient.OnSetAppearance += SetAppearance; m_controllingClient.OnSetAppearance += SetAppearance;
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
m_controllingClient.OnCompleteMovementToRegion += SendInitialData; //m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
m_controllingClient.OnAgentUpdate += HandleAgentUpdate; m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
m_controllingClient.OnAgentSit += HandleAgentSit; m_controllingClient.OnAgentSit += HandleAgentSit;
@ -829,7 +829,6 @@ namespace OpenSim.Region.Framework.Scenes
pos = emergencyPos; pos = emergencyPos;
} }
m_isChildAgent = false;
float localAVHeight = 1.56f; float localAVHeight = 1.56f;
if (m_avHeight != 127.0f) if (m_avHeight != 127.0f)
@ -845,8 +844,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene(); AddToPhysicalScene(isFlying);
m_physicsActor.Flying = isFlying; SetHeight(m_appearance.AvatarHeight);
// Don't send an animation pack here, since on a region crossing this will sometimes cause a flying // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
// avatar to return to the standing position in mid-air. On login it looks like this is being sent // avatar to return to the standing position in mid-air. On login it looks like this is being sent
@ -861,13 +860,16 @@ namespace OpenSim.Region.Framework.Scenes
else else
m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
//m_scene.CapsModule.AddCapsHandler(m_uuid);
// On the next prim update, all objects will be sent // On the next prim update, all objects will be sent
// //
m_pendingObjects = null; m_pendingObjects = null;
m_isChildAgent = false;
SendInitialData();
m_scene.EventManager.TriggerOnMakeRootAgent(this); m_scene.EventManager.TriggerOnMakeRootAgent(this);
} }
/// <summary> /// <summary>
@ -916,10 +918,14 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="pos"></param> /// <param name="pos"></param>
public void Teleport(Vector3 pos) public void Teleport(Vector3 pos)
{ {
bool isFlying = false;
if (m_physicsActor != null)
isFlying = m_physicsActor.Flying;
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
Velocity = new Vector3(0, 0, 0); Velocity = new Vector3(0, 0, 0);
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene(); AddToPhysicalScene(isFlying);
SendTerseUpdateToAllClients(); SendTerseUpdateToAllClients();
} }
@ -1021,8 +1027,8 @@ namespace OpenSim.Region.Framework.Scenes
if (m_isChildAgent) if (m_isChildAgent)
{ {
m_isChildAgent = false; m_isChildAgent = false;
bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
MakeRootAgent(AbsolutePosition, false); MakeRootAgent(AbsolutePosition, m_flying);
if ((m_callbackURI != null) && !m_callbackURI.Equals("")) if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
{ {
@ -1068,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903"); m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903");
} }
AddToPhysicalScene(); AddToPhysicalScene(false);
} }
else else
{ {
@ -1464,7 +1470,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_physicsActor == null) if (m_physicsActor == null)
{ {
AddToPhysicalScene(); AddToPhysicalScene(m_physicsActor.Flying);
} }
m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
@ -2231,7 +2237,7 @@ namespace OpenSim.Region.Framework.Scenes
// just to add it back again, but it saves us from having to update // just to add it back again, but it saves us from having to update
// 3 variables 10 times a second. // 3 variables 10 times a second.
m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
AddToPhysicalScene(); AddToPhysicalScene(m_physicsActor.Flying);
} }
m_appearance.SetAppearance(texture, visualParam); m_appearance.SetAppearance(texture, visualParam);
SetHeight(m_appearance.AvatarHeight); SetHeight(m_appearance.AvatarHeight);
@ -2420,12 +2426,18 @@ namespace OpenSim.Region.Framework.Scenes
protected void CrossToNewRegion() protected void CrossToNewRegion()
{ {
m_inTransit = true; m_inTransit = true;
if ((m_physicsActor != null) && m_physicsActor.Flying)
m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
else if ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0)
m_AgentControlFlags &= ~(uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying);
} }
public void RestoreInCurrentScene() public void RestoreInCurrentScene()
{ {
AddToPhysicalScene(); AddToPhysicalScene(false); // not exactly false
} }
/// <summary> /// <summary>
@ -2583,10 +2595,6 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.HeadRotation = m_headrotation; cAgent.HeadRotation = m_headrotation;
cAgent.BodyRotation = m_bodyRot; cAgent.BodyRotation = m_bodyRot;
cAgent.ControlFlags = m_AgentControlFlags; cAgent.ControlFlags = m_AgentControlFlags;
if ((m_physicsActor != null) && (m_physicsActor.Flying))
{
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
}
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
cAgent.GodLevel = (byte)m_godlevel; cAgent.GodLevel = (byte)m_godlevel;
@ -2625,10 +2633,7 @@ namespace OpenSim.Region.Framework.Scenes
m_headrotation = cAgent.HeadRotation; m_headrotation = cAgent.HeadRotation;
m_bodyRot = cAgent.BodyRotation; m_bodyRot = cAgent.BodyRotation;
m_AgentControlFlags = cAgent.ControlFlags; // We need more flags! m_AgentControlFlags = cAgent.ControlFlags; // We need more flags!
if (m_physicsActor != null)
{
m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
}
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
m_godlevel = cAgent.GodLevel; m_godlevel = cAgent.GodLevel;
m_setAlwaysRun = cAgent.AlwaysRun; m_setAlwaysRun = cAgent.AlwaysRun;
@ -2755,7 +2760,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Adds a physical representation of the avatar to the Physics plugin /// Adds a physical representation of the avatar to the Physics plugin
/// </summary> /// </summary>
public void AddToPhysicalScene() public void AddToPhysicalScene(bool isFlying)
{ {
PhysicsScene scene = m_scene.PhysicsScene; PhysicsScene scene = m_scene.PhysicsScene;
@ -2765,11 +2770,11 @@ namespace OpenSim.Region.Framework.Scenes
if (m_avHeight == 127.0f) if (m_avHeight == 127.0f)
{ {
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f)); m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), isFlying);
} }
else else
{ {
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight)); m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight), isFlying);
} }
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;

View File

@ -83,10 +83,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
} }
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
{ {
BasicActor act = new BasicActor(); BasicActor act = new BasicActor();
act.Position = position; act.Position = position;
act.Flying = isFlying;
_actors.Add(act); _actors.Add(act);
return act; return act;
} }

View File

@ -573,13 +573,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
} }
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
{ {
PhysicsVector pos = new PhysicsVector(); PhysicsVector pos = new PhysicsVector();
pos.X = position.X; pos.X = position.X;
pos.Y = position.Y; pos.Y = position.Y;
pos.Z = position.Z + 20; pos.Z = position.Z + 20;
BulletXCharacter newAv = null; BulletXCharacter newAv = null;
newAv.Flying = isFlying;
lock (BulletXLock) lock (BulletXLock)
{ {
newAv = new BulletXCharacter(avName, this, pos); newAv = new BulletXCharacter(avName, this, pos);

View File

@ -62,7 +62,7 @@ namespace OpenSim.Region.Physics.Manager
public abstract void Initialise(IMesher meshmerizer, IConfigSource config); public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size); public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying);
public abstract void RemoveAvatar(PhysicsActor actor); public abstract void RemoveAvatar(PhysicsActor actor);
@ -162,7 +162,7 @@ namespace OpenSim.Region.Physics.Manager
// Does nothing right now // Does nothing right now
} }
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
{ {
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
return PhysicsActor.Null; return PhysicsActor.Null;

View File

@ -1313,13 +1313,14 @@ namespace OpenSim.Region.Physics.OdePlugin
#region Add/Remove Entities #region Add/Remove Entities
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
{ {
PhysicsVector pos = new PhysicsVector(); PhysicsVector pos = new PhysicsVector();
pos.X = position.X; pos.X = position.X;
pos.Y = position.Y; pos.Y = position.Y;
pos.Z = position.Z; pos.Z = position.Z;
OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun); OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun);
newAv.Flying = isFlying;
_characters.Add(newAv); _characters.Add(newAv);
return newAv; return newAv;
} }

View File

@ -56,10 +56,11 @@ namespace OpenSim.Region.Physics.POSPlugin
{ {
} }
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
{ {
POSCharacter act = new POSCharacter(); POSCharacter act = new POSCharacter();
act.Position = position; act.Position = position;
act.Flying = isFlying;
_characters.Add(act); _characters.Add(act);
return act; return act;
} }

View File

@ -102,13 +102,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin
} }
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
{ {
Vec3 pos = new Vec3(); Vec3 pos = new Vec3();
pos.X = position.X; pos.X = position.X;
pos.Y = position.Y; pos.Y = position.Y;
pos.Z = position.Z; pos.Z = position.Z;
PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos)); PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos));
act.Flying = isFlying;
act.Position = position; act.Position = position;
_characters.Add(act); _characters.Add(act);
return act; return act;