reduce the chance of using a invalid avatar physics actor
parent
bd1b992aaf
commit
87733b196b
|
@ -507,7 +507,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Physical scene representation of this Avatar.
|
/// Physical scene representation of this Avatar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PhysicsActor PhysicsActor { get; private set; }
|
|
||||||
|
PhysicsActor m_physActor;
|
||||||
|
public PhysicsActor PhysicsActor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_physActor;
|
||||||
|
}
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
m_physActor = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Record user movement inputs.
|
/// Record user movement inputs.
|
||||||
|
@ -1641,15 +1653,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RemoveFromPhysicalScene()
|
public void RemoveFromPhysicalScene()
|
||||||
{
|
{
|
||||||
if (PhysicsActor != null)
|
PhysicsActor pa = Interlocked.Exchange(ref m_physActor, null);
|
||||||
|
if (pa != null)
|
||||||
{
|
{
|
||||||
// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
|
// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
|
||||||
|
|
||||||
PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
|
pa.OnOutOfBounds -= OutOfBoundsCall;
|
||||||
PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
|
pa.OnCollisionUpdate -= PhysicsCollisionUpdate;
|
||||||
PhysicsActor.UnSubscribeEvents();
|
pa.UnSubscribeEvents();
|
||||||
m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
|
m_scene.PhysicsScene.RemoveAvatar(pa);
|
||||||
PhysicsActor = null;
|
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
@ -2542,7 +2554,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_pos.X = 127f;
|
m_pos.X = 127f;
|
||||||
m_pos.Y = 127f;
|
m_pos.Y = 127f;
|
||||||
m_pos.Z = 127f;
|
m_pos.Z = 127f;
|
||||||
m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error #9999903");
|
m_log.Error("[AVATAR]: NonFinite Avatar on lastFiniteposition also. Reset Position. Mantis this please. Error #9999903");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isphysical)
|
if(isphysical)
|
||||||
|
@ -5012,16 +5024,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PhysicsScene scene = m_scene.PhysicsScene;
|
PhysicsScene scene = m_scene.PhysicsScene;
|
||||||
Vector3 pVec = AbsolutePosition;
|
Vector3 pVec = AbsolutePosition;
|
||||||
|
|
||||||
PhysicsActor = scene.AddAvatar(
|
PhysicsActor pa = scene.AddAvatar(
|
||||||
LocalId, Firstname + "." + Lastname, pVec,
|
LocalId, Firstname + "." + Lastname, pVec,
|
||||||
Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying);
|
Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying);
|
||||||
PhysicsActor.Orientation = m_bodyRot;
|
pa.Orientation = m_bodyRot;
|
||||||
//PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
//PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||||
PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
|
pa.OnCollisionUpdate += PhysicsCollisionUpdate;
|
||||||
PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
|
pa.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
|
||||||
PhysicsActor.SubscribeEvents(100);
|
pa.SubscribeEvents(100);
|
||||||
PhysicsActor.LocalID = LocalId;
|
pa.LocalID = LocalId;
|
||||||
PhysicsActor.SetAlwaysRun = m_setAlwaysRun;
|
pa.SetAlwaysRun = m_setAlwaysRun;
|
||||||
|
PhysicsActor = pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutOfBoundsCall(Vector3 pos)
|
private void OutOfBoundsCall(Vector3 pos)
|
||||||
|
|
Loading…
Reference in New Issue