Use a boolean flag to signal lookat is running instead of Quaternion.Identity so it can be a valid target orientation

inv-download
dahlia 2015-02-16 19:42:36 -08:00
parent 2700b096bc
commit 78814a1533
1 changed files with 10 additions and 4 deletions

View File

@ -266,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes
public Quaternion SpinOldOrientation = Quaternion.Identity; public Quaternion SpinOldOrientation = Quaternion.Identity;
protected int m_APIDIterations = 0; protected bool m_APIDActive = false;
protected Quaternion m_APIDTarget = Quaternion.Identity; protected Quaternion m_APIDTarget = Quaternion.Identity;
protected float m_APIDDamp = 0; protected float m_APIDDamp = 0;
protected float m_APIDStrength = 0; protected float m_APIDStrength = 0;
@ -642,6 +642,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected bool APIDActive
{
get { return m_APIDActive; }
set { m_APIDActive = value; }
}
protected Quaternion APIDTarget protected Quaternion APIDTarget
{ {
get { return m_APIDTarget; } get { return m_APIDTarget; }
@ -2621,7 +2627,7 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); APIDActive = true;
} }
// Necessary to get the lookat deltas applied // Necessary to get the lookat deltas applied
@ -2635,7 +2641,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StopLookAt() public void StopLookAt()
{ {
APIDTarget = Quaternion.Identity; APIDActive = false;
} }
@ -4884,7 +4890,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
try try
{ {
if (APIDTarget != Quaternion.Identity) if (APIDActive)
{ {
PhysicsActor pa = ParentGroup.RootPart.PhysActor; PhysicsActor pa = ParentGroup.RootPart.PhysActor;
if (pa == null || !pa.IsPhysical || APIDStrength < 0.04) if (pa == null || !pa.IsPhysical || APIDStrength < 0.04)