mantis 8250: a few more changes
parent
337832ecbe
commit
5167bd097b
|
@ -3047,20 +3047,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// We are close enough to the target
|
// We are close enough to the target
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
AbsolutePosition = m_moveToPositionTarget;
|
|
||||||
if (Flying)
|
if (Flying)
|
||||||
{
|
{
|
||||||
if (LandAtTarget)
|
if (LandAtTarget)
|
||||||
|
{
|
||||||
Flying = false;
|
Flying = false;
|
||||||
|
|
||||||
// A horrible hack to stop the avatar dead in its tracks rather than having them overshoot
|
// A horrible hack to stop the avatar dead in its tracks rather than having them overshoot
|
||||||
// the target if flying.
|
// the target if flying.
|
||||||
// We really need to be more subtle (slow the avatar as it approaches the target) or at
|
// We really need to be more subtle (slow the avatar as it approaches the target) or at
|
||||||
// least be able to set collision status once, rather than 5 times to give it enough
|
// least be able to set collision status once, rather than 5 times to give it enough
|
||||||
// weighting so that that PhysicsActor thinks it really is colliding.
|
// weighting so that that PhysicsActor thinks it really is colliding.
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
IsColliding = true;
|
IsColliding = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_moveToPositionTarget.Z = AbsolutePosition.Z;
|
||||||
|
|
||||||
|
AbsolutePosition = m_moveToPositionTarget;
|
||||||
|
|
||||||
ResetMoveToTarget();
|
ResetMoveToTarget();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3081,6 +3087,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Quaternion rot = new Quaternion(0,0, (float)Math.Sin(angle),(float)Math.Cos(angle));
|
Quaternion rot = new Quaternion(0,0, (float)Math.Sin(angle),(float)Math.Cos(angle));
|
||||||
Rotation = rot;
|
Rotation = rot;
|
||||||
LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(rot); // change to avatar coords
|
LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(rot); // change to avatar coords
|
||||||
|
if(!Flying)
|
||||||
|
LocalVectorToTarget3D.Z = 0;
|
||||||
LocalVectorToTarget3D.Normalize();
|
LocalVectorToTarget3D.Normalize();
|
||||||
|
|
||||||
// update avatar movement flags. the avatar coordinate system is as follows:
|
// update avatar movement flags. the avatar coordinate system is as follows:
|
||||||
|
@ -3166,7 +3174,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void MoveToTargetHandle(Vector3 pos, bool noFly, bool landAtTarget)
|
public void MoveToTargetHandle(Vector3 pos, bool noFly, bool landAtTarget)
|
||||||
{
|
{
|
||||||
MoveToTarget(pos, noFly, false, landAtTarget);
|
MoveToTarget(pos, noFly, landAtTarget, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3219,35 +3227,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
|
// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
|
||||||
// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
bool shouldfly = true;;
|
bool shouldfly = true;
|
||||||
if (!Flying)
|
if(IsNPC)
|
||||||
shouldfly = noFly ? false : (pos.Z > terrainHeight + Appearance.AvatarHeight);
|
{
|
||||||
|
if (!Flying)
|
||||||
|
shouldfly = noFly ? false : (pos.Z > terrainHeight + Appearance.AvatarHeight);
|
||||||
|
LandAtTarget = landAtTarget & shouldfly;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we have no control on viewer fly state
|
||||||
|
shouldfly = Flying || (pos.Z > terrainHeight + Appearance.AvatarHeight);
|
||||||
|
LandAtTarget = false;
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 localVectorToTarget3D = pos - AbsolutePosition;
|
// m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y);
|
||||||
|
|
||||||
// m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y);
|
|
||||||
|
|
||||||
m_movingToTarget = true;
|
m_movingToTarget = true;
|
||||||
LandAtTarget = landAtTarget & shouldfly;
|
|
||||||
m_moveToPositionTarget = pos;
|
m_moveToPositionTarget = pos;
|
||||||
if(tau > 0)
|
if(tau > 0)
|
||||||
{
|
{
|
||||||
if(tau < Scene.FrameTime)
|
if(tau < Scene.FrameTime)
|
||||||
tau = Scene.FrameTime;
|
tau = Scene.FrameTime;
|
||||||
|
Vector3 localVectorToTarget3D = pos - AbsolutePosition;
|
||||||
|
if (!shouldfly)
|
||||||
|
localVectorToTarget3D.Z = 0;
|
||||||
m_moveToSpeed = localVectorToTarget3D.Length() / tau;
|
m_moveToSpeed = localVectorToTarget3D.Length() / tau;
|
||||||
if(m_moveToSpeed < 0.5f) //to tune
|
if(m_moveToSpeed < 0.5f) //to tune
|
||||||
m_moveToSpeed = 0.5f;
|
m_moveToSpeed = 0.5f;
|
||||||
else if(m_moveToSpeed > 50f)
|
else if(m_moveToSpeed > 50f)
|
||||||
m_moveToSpeed = 50f;
|
m_moveToSpeed = 50f;
|
||||||
|
|
||||||
SetAlwaysRun = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_moveToSpeed = 4.096f * m_speedModifier;
|
m_moveToSpeed = 4.096f * m_speedModifier;
|
||||||
SetAlwaysRun = running;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
SetAlwaysRun = running;
|
||||||
Flying = shouldfly;
|
Flying = shouldfly;
|
||||||
|
|
||||||
Vector3 control = Vector3.Zero;
|
Vector3 control = Vector3.Zero;
|
||||||
|
|
Loading…
Reference in New Issue