Add nudge right and left to avatar movement (faster reaction times when stepping left or right.)

avinationmerge
CasperW 2009-11-26 01:59:08 +01:00
parent 25b4160434
commit b9d22aa821
1 changed files with 14 additions and 6 deletions

View File

@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes
protected RegionInfo m_regionInfo; protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion; protected ulong crossingFromRegion;
private readonly Vector3[] Dir_Vectors = new Vector3[9]; private readonly Vector3[] Dir_Vectors = new Vector3[11];
private bool m_isNudging = false; private bool m_isNudging = false;
// Position of agent's camera in world (region cordinates) // Position of agent's camera in world (region cordinates)
@ -236,6 +236,8 @@ namespace OpenSim.Region.Framework.Scenes
DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS,
DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG,
DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
} }
@ -722,12 +724,14 @@ namespace OpenSim.Region.Framework.Scenes
Dir_Vectors[5] = -Vector3.UnitZ; //DOWN Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
} }
private Vector3[] GetWalkDirectionVectors() private Vector3[] GetWalkDirectionVectors()
{ {
Vector3[] vector = new Vector3[9]; Vector3[] vector = new Vector3[11];
vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
vector[2] = Vector3.UnitY; //LEFT vector[2] = Vector3.UnitY; //LEFT
@ -736,13 +740,15 @@ namespace OpenSim.Region.Framework.Scenes
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge vector[8] = Vector3.UnitY; //LEFT_NUDGE
vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
return vector; return vector;
} }
private bool[] GetDirectionIsNudge() private bool[] GetDirectionIsNudge()
{ {
bool[] isNudge = new bool[9]; bool[] isNudge = new bool[11];
isNudge[0] = false; //FORWARD isNudge[0] = false; //FORWARD
isNudge[1] = false; //BACK isNudge[1] = false; //BACK
isNudge[2] = false; //LEFT isNudge[2] = false; //LEFT
@ -751,7 +757,9 @@ namespace OpenSim.Region.Framework.Scenes
isNudge[5] = false; //DOWN isNudge[5] = false; //DOWN
isNudge[6] = true; //FORWARD_NUDGE isNudge[6] = true; //FORWARD_NUDGE
isNudge[7] = true; //BACK_NUDGE isNudge[7] = true; //BACK_NUDGE
isNudge[8] = true; //DOWN_Nudge isNudge[8] = true; //LEFT_NUDGE
isNudge[9] = true; //RIGHT_NUDGE
isNudge[10] = true; //DOWN_Nudge
return isNudge; return isNudge;
} }