Fix a nullref issue in SitAltitudeCallback
parent
fc76b5f589
commit
f77f9ecd8f
|
@ -128,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation
|
private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation
|
||||||
private Vector3 m_avUnscriptedSitPos; // for non-scripted prims
|
private Vector3 m_avUnscriptedSitPos; // for non-scripted prims
|
||||||
private Vector3 m_lastPosition;
|
private Vector3 m_lastPosition;
|
||||||
private Vector3 m_lastWorldPosition;
|
private Vector3 m_lastWorldPosition;
|
||||||
private Quaternion m_lastRotation;
|
private Quaternion m_lastRotation;
|
||||||
private Vector3 m_lastVelocity;
|
private Vector3 m_lastVelocity;
|
||||||
|
@ -857,22 +857,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
|
Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
|
||||||
pos.Y = crossedBorder.BorderLine.Z - 1;
|
pos.Y = crossedBorder.BorderLine.Z - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If they're TP'ing in or logging in, we haven't had time to add any known child regions yet.
|
//If they're TP'ing in or logging in, we haven't had time to add any known child regions yet.
|
||||||
//This has the unfortunate consequence that if somebody is TP'ing who is already a child agent,
|
//This has the unfortunate consequence that if somebody is TP'ing who is already a child agent,
|
||||||
//they'll bypass the landing point. But I can't think of any decent way of fixing this.
|
//they'll bypass the landing point. But I can't think of any decent way of fixing this.
|
||||||
if (KnownChildRegionHandles.Count == 0)
|
if (KnownChildRegionHandles.Count == 0)
|
||||||
{
|
{
|
||||||
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
if (land != null)
|
if (land != null)
|
||||||
{
|
{
|
||||||
//Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni.
|
//Don't restrict gods, estate managers, or land owners to the TP point. This behaviour mimics agni.
|
||||||
if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_godlevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid)
|
if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero && m_godlevel < 200 && !m_scene.RegionInfo.EstateSettings.IsEstateManager(m_uuid) && land.LandData.OwnerID != m_uuid)
|
||||||
{
|
{
|
||||||
pos = land.LandData.UserLocation;
|
pos = land.LandData.UserLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
|
if (pos.X < 0 || pos.Y < 0 || pos.Z < 0)
|
||||||
|
@ -1036,8 +1036,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool isFlying = false;
|
bool isFlying = false;
|
||||||
|
|
||||||
if (m_physicsActor != null)
|
if (m_physicsActor != null)
|
||||||
isFlying = m_physicsActor.Flying;
|
isFlying = m_physicsActor.Flying;
|
||||||
|
|
||||||
RemoveFromPhysicalScene();
|
RemoveFromPhysicalScene();
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
AbsolutePosition = pos;
|
AbsolutePosition = pos;
|
||||||
|
@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SetHeight(m_appearance.AvatarHeight);
|
SetHeight(m_appearance.AvatarHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendTerseUpdateToAllClients();
|
SendTerseUpdateToAllClients();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,14 +1736,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// else
|
// else
|
||||||
// { // single or child prim
|
// { // single or child prim
|
||||||
|
|
||||||
// }
|
// }
|
||||||
if (part == null) //CW: Part may be gone. llDie() for example.
|
if (part == null) //CW: Part may be gone. llDie() for example.
|
||||||
{
|
{
|
||||||
partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
|
partRot = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
partRot = part.GetWorldRotation();
|
partRot = part.GetWorldRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
Quaternion partIRot = Quaternion.Inverse(partRot);
|
Quaternion partIRot = Quaternion.Inverse(partRot);
|
||||||
|
@ -1751,22 +1751,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av
|
Quaternion avatarRot = Quaternion.Inverse(Quaternion.Inverse(Rotation) * partIRot); // world or. of the av
|
||||||
Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av
|
Vector3 avStandUp = new Vector3(1.0f, 0f, 0f) * avatarRot; // 1M infront of av
|
||||||
|
|
||||||
|
|
||||||
if (m_physicsActor == null)
|
if (m_physicsActor == null)
|
||||||
{
|
{
|
||||||
AddToPhysicalScene(false);
|
AddToPhysicalScene(false);
|
||||||
}
|
}
|
||||||
//CW: If the part isn't null then we can set the current position
|
//CW: If the part isn't null then we can set the current position
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset!
|
Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset!
|
||||||
AbsolutePosition = avWorldStandUp; //KF: Fix stand up.
|
AbsolutePosition = avWorldStandUp; //KF: Fix stand up.
|
||||||
part.IsOccupied = false;
|
part.IsOccupied = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//CW: Since the part doesn't exist, a coarse standup position isn't an issue
|
//CW: Since the part doesn't exist, a coarse standup position isn't an issue
|
||||||
AbsolutePosition = m_lastWorldPosition;
|
AbsolutePosition = m_lastWorldPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parentPosition = Vector3.Zero;
|
m_parentPosition = Vector3.Zero;
|
||||||
|
@ -1920,7 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
|
// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
|
||||||
if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) )
|
if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) )
|
||||||
{
|
{
|
||||||
autopilot = false; // close enough
|
autopilot = false; // close enough
|
||||||
m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup.
|
m_lastWorldPosition = m_pos; /* CW - This give us a position to return the avatar to if the part is killed before standup.
|
||||||
Not using the part's position because returning the AV to the last known standing
|
Not using the part's position because returning the AV to the last known standing
|
||||||
position is likely to be more friendly, isn't it? */
|
position is likely to be more friendly, isn't it? */
|
||||||
|
@ -1929,7 +1929,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
} // else the autopilot will get us close
|
} // else the autopilot will get us close
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // its a scripted sit
|
{ // its a scripted sit
|
||||||
m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup.
|
m_lastWorldPosition = part.AbsolutePosition; /* CW - This give us a position to return the avatar to if the part is killed before standup.
|
||||||
I *am* using the part's position this time because we have no real idea how far away
|
I *am* using the part's position this time because we have no real idea how far away
|
||||||
the avatar is from the sit target. */
|
the avatar is from the sit target. */
|
||||||
|
@ -2357,11 +2357,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// { // single or child prim
|
// { // single or child prim
|
||||||
partIRot = Quaternion.Inverse(part.GetWorldRotation());
|
partIRot = Quaternion.Inverse(part.GetWorldRotation());
|
||||||
// }
|
// }
|
||||||
float offZ = collisionPoint.Z - m_initialSitTarget.Z;
|
if (m_initialSitTarget != null)
|
||||||
Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
|
{
|
||||||
//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset);
|
float offZ = collisionPoint.Z - m_initialSitTarget.Z;
|
||||||
m_pos += offset;
|
Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
|
||||||
// ControllingClient.SendClearFollowCamProperties(part.UUID);
|
//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset);
|
||||||
|
m_pos += offset;
|
||||||
|
// ControllingClient.SendClearFollowCamProperties(part.UUID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} // End SitAltitudeCallback KF.
|
} // End SitAltitudeCallback KF.
|
||||||
|
|
Loading…
Reference in New Issue