public void Update(MoveCharacter moveCharacter, MovementAction movementAction, Vector3 targetPosition, float rotation = 0f) { if (movementAction == MovementAction.DirectMove) { moveCharacter?.Invoke(targetPosition); return; } List <Vector3> forces = GetForces(movementAction, targetPosition, rotation); for (int i = 0; i < forces.Count; ++i) { Velocity += forces[i]; } if (IsOnWaterSurface && Velocity.Z > 0f) { Velocity = new Vector3(Velocity.X, Velocity.Y, 0f); } Velocity.Limit(WowInterface.MovementSettings.MaxVelocity); Vector3 currentPosition = WowInterface.ObjectManager.Player.Position; currentPosition.Add(Velocity); moveCharacter?.Invoke(currentPosition); }
public void Update(MoveCharacter moveCharacter, MovementAction movementAction, Vector3 targetPosition, float rotation = 0f) { if (movementAction == MovementAction.DirectMove) { moveCharacter?.Invoke(targetPosition); return; } List <Vector3> forces = GetForces(movementAction, targetPosition, rotation); foreach (Vector3 force in forces) { Velocity += force; } if (IsOnWaterSurface && Velocity.Z > 0f) { Velocity = new(Velocity.X, Velocity.Y, 0f); } float maxVelocity = Config.MovementSettings.MaxVelocity; if (Bot.Player.IsMounted) { maxVelocity *= 2; } Velocity.Limit(maxVelocity); Vector3 currentPosition = Bot.Player.Position; currentPosition.Add(Velocity); moveCharacter?.Invoke(currentPosition); }
public void Update(MoveCharacter moveCharacter, MovementAction movementAction, Vector3 targetPosition, float rotation, float maxSteering, float maxVelocity, float seperationDistance) { if (movementAction == MovementAction.DirectMove) { moveCharacter?.Invoke(targetPosition); return; } // adjust max steering based on time passed since last Update() call float timedelta = (float)(DateTime.UtcNow - LastUpdate).TotalSeconds; float maxSteeringNormalized = maxSteering * timedelta; Vector3 totalforce = GetForce(movementAction, targetPosition, rotation, maxSteeringNormalized, maxVelocity, seperationDistance); Velocity += totalforce; Velocity.Truncate(maxVelocity); moveCharacter?.Invoke(Bot.Player.Position + Velocity); LastUpdate = DateTime.UtcNow; }