physics-related fixes; should stabilize border crossings
parent
3eb1a23ac1
commit
d3050724d8
|
@ -833,6 +833,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (presence.PhysicsActor != null)
|
if (presence.PhysicsActor != null)
|
||||||
{
|
{
|
||||||
phyScene.RemoveAvatar(presence.PhysicsActor);
|
phyScene.RemoveAvatar(presence.PhysicsActor);
|
||||||
|
presence.PhysicsActor = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1028,7 +1029,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (m_scenePresences.ContainsKey(agentID))
|
if (m_scenePresences.ContainsKey(agentID))
|
||||||
{
|
{
|
||||||
m_scenePresences[agentID].MakeAvatar(position, isFlying);
|
m_scenePresences[agentID].MakeAvatarPhysical(position, isFlying);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MakeAvatar(LLVector3 pos, bool isFlying)
|
public void MakeAvatarPhysical(LLVector3 pos, bool isFlying)
|
||||||
{
|
{
|
||||||
newAvatar = true;
|
newAvatar = true;
|
||||||
childAgent = false;
|
childAgent = false;
|
||||||
|
@ -363,6 +363,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private void RemoveFromPhysicalScene()
|
private void RemoveFromPhysicalScene()
|
||||||
{
|
{
|
||||||
m_scene.PhysScene.RemoveAvatar( this.PhysicsActor );
|
m_scene.PhysScene.RemoveAvatar( this.PhysicsActor );
|
||||||
|
this.PhysicsActor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -429,6 +430,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="pack"></param>
|
/// <param name="pack"></param>
|
||||||
public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
|
public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
|
||||||
{
|
{
|
||||||
|
if (childAgent)
|
||||||
|
{
|
||||||
|
Console.WriteLine("DEBUG: HandleAgentUpdate: child agent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(PhysicsActor==null) {
|
||||||
|
Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
bool update_movementflag = false;
|
bool update_movementflag = false;
|
||||||
bool update_rotation = false;
|
bool update_rotation = false;
|
||||||
|
@ -501,6 +511,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
protected void AddNewMovement(Vector3 vec, Quaternion rotation)
|
protected void AddNewMovement(Vector3 vec, Quaternion rotation)
|
||||||
{
|
{
|
||||||
|
if (childAgent)
|
||||||
|
{
|
||||||
|
Console.WriteLine("DEBUG: AddNewMovement: child agent");
|
||||||
|
return;
|
||||||
|
}
|
||||||
NewForce newVelocity = new NewForce();
|
NewForce newVelocity = new NewForce();
|
||||||
Vector3 direc = rotation*vec;
|
Vector3 direc = rotation*vec;
|
||||||
direc.Normalize();
|
direc.Normalize();
|
||||||
|
|
|
@ -152,9 +152,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
public override void RemoveAvatar(PhysicsActor actor)
|
public override void RemoveAvatar(PhysicsActor actor)
|
||||||
{
|
{
|
||||||
OdeCharacter och = (OdeCharacter)actor;
|
((OdeCharacter)actor).Destroy();
|
||||||
d.BodyDestroy(och.BoundingCapsule);
|
_characters.Remove((OdeCharacter)actor);
|
||||||
_characters.Remove(och);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RemovePrim(PhysicsActor prim)
|
public override void RemovePrim(PhysicsActor prim)
|
||||||
|
@ -449,6 +448,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
this._position.Y = vec.Y;
|
this._position.Y = vec.Y;
|
||||||
this._position.Z = vec.Z;
|
this._position.Z = vec.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Destroy()
|
||||||
|
{
|
||||||
|
lock (OdeScene.OdeLock)
|
||||||
|
{
|
||||||
|
d.GeomDestroy(this.capsule_geom);
|
||||||
|
d.BodyDestroy(this.BoundingCapsule);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OdePrim : PhysicsActor
|
public class OdePrim : PhysicsActor
|
||||||
|
|
Loading…
Reference in New Issue