Chnaging the sit target adjustment to a more precise approximation of SL. Some small

fixes ported from Avination. Some white space fixes.
remove-scene-viewer
Melanie 2011-11-05 21:24:36 +00:00
parent e8a8e462ed
commit b6df9e9fe4
1 changed files with 35 additions and 24 deletions

View File

@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes
/// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
/// issue #1716 /// issue #1716
/// </summary> /// </summary>
public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f);
/// <summary> /// <summary>
/// Movement updates for agents in neighboring regions are sent directly to clients. /// Movement updates for agents in neighboring regions are sent directly to clients.
@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes
protected ulong crossingFromRegion; protected ulong crossingFromRegion;
private readonly Vector3[] Dir_Vectors = new Vector3[9]; private readonly Vector3[] Dir_Vectors = new Vector3[11];
protected Timer m_reprioritization_timer; protected Timer m_reprioritization_timer;
@ -241,6 +241,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_BACKWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, DIR_CONTROL_FLAG_BACKWARD_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
} }
@ -479,7 +481,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get get
{ {
if (PhysicsActor != null) if (PhysicsActor != null && m_parentID == 0)
{ {
m_pos = PhysicsActor.Position; m_pos = PhysicsActor.Position;
@ -507,7 +509,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
if (part != null) if (part != null)
{ {
return ParentPosition + (m_pos * part.GetWorldRotation()); return part.AbsolutePosition + (m_pos * part.GetWorldRotation());
} }
else else
{ {
@ -816,23 +818,27 @@ namespace OpenSim.Region.Framework.Scenes
Dir_Vectors[3] = -Vector3.UnitY; //RIGHT Dir_Vectors[3] = -Vector3.UnitY; //RIGHT
Dir_Vectors[4] = Vector3.UnitZ; //UP Dir_Vectors[4] = Vector3.UnitZ; //UP
Dir_Vectors[5] = -Vector3.UnitZ; //DOWN Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
Dir_Vectors[6] = Vector3.UnitX*2; //FORWARD Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
Dir_Vectors[7] = -Vector3.UnitX; //BACK 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, -CameraAtAxis.Z); //FORWARD vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, 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
vector[3] = -Vector3.UnitY; //RIGHT vector[3] = -Vector3.UnitY; //RIGHT
vector[4] = new Vector3(CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP
vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
vector[8] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z) * 2); //FORWARD Nudge vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK 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;
} }
@ -1030,6 +1036,8 @@ namespace OpenSim.Region.Framework.Scenes
private void RemoveFromPhysicalScene() private void RemoveFromPhysicalScene()
{ {
if (PhysicsActor != null) if (PhysicsActor != null)
{
try
{ {
PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
@ -1038,6 +1046,9 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
PhysicsActor = null; PhysicsActor = null;
} }
catch
{ }
}
} }
/// <summary> /// <summary>