eliminate the rotation parameter from SP.HandleMoveToTargetUpdate(). This can just use the currently set Rotation

looks like I spoke to soon about eliminating jerkiness on "go here"/autopilot.  It's still there.
bulletsim
Justin Clark-Casey (justincc) 2011-08-11 03:05:51 +01:00
parent 36f7d36fa1
commit 1aa1711893
2 changed files with 10 additions and 6 deletions

View File

@ -1496,7 +1496,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else if (bAllowUpdateMoveToPosition) else if (bAllowUpdateMoveToPosition)
{ {
if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation)) if (HandleMoveToTargetUpdate(ref agent_control_v3))
update_movementflag = true; update_movementflag = true;
} }
} }
@ -1556,9 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes
/// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
/// </remarks> /// </remarks>
/// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
/// <param value="bodyRotation">New body rotation of the avatar.</param>
/// <returns>True if movement has been updated in some way. False otherwise.</returns> /// <returns>True if movement has been updated in some way. False otherwise.</returns>
public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation) public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
@ -1594,7 +1593,7 @@ namespace OpenSim.Region.Framework.Scenes
// to such forces, but the following simple approach seems to works fine. // to such forces, but the following simple approach seems to works fine.
Vector3 LocalVectorToTarget3D = Vector3 LocalVectorToTarget3D =
(MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
* Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords
// Ignore z component of vector // Ignore z component of vector
// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); // Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
LocalVectorToTarget3D.Normalize(); LocalVectorToTarget3D.Normalize();
@ -1731,7 +1730,7 @@ namespace OpenSim.Region.Framework.Scenes
MoveToPositionTarget = pos; MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3(); Vector3 agent_control_v3 = new Vector3();
HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); HandleMoveToTargetUpdate(ref agent_control_v3);
AddNewMovement(agent_control_v3); AddNewMovement(agent_control_v3);
} }

View File

@ -81,6 +81,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (presence.PhysicsActor.Flying) if (presence.PhysicsActor.Flying)
{ {
// A horrible hack to stop the NPC dead in its tracks rather than having them overshoot
// the target if flying.
// 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
// weighting so that that PhysicsActor thinks it really is colliding.
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
presence.PhysicsActor.IsColliding = true; presence.PhysicsActor.IsColliding = true;
@ -106,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
Vector3 agent_control_v3 = new Vector3(); Vector3 agent_control_v3 = new Vector3();
presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); presence.HandleMoveToTargetUpdate(ref agent_control_v3);
presence.AddNewMovement(agent_control_v3); presence.AddNewMovement(agent_control_v3);
} }
// //