/* update model using controller for navigating to "to". return true if inProgress*/ public bool updateModel(Vector3 to) { bool inProgress = controller.computeTargetedControl(vehicle.transform.forward, vehicle.transform.position, to); TargetedControllerResult res = controller.getOutput(); vehicle.rigidbody.velocity = Vector3.ClampMagnitude(res.direction, res.velocity) * MyUtils.movementK * Time.deltaTime; return(inProgress); }
/* update model with Targeted Input */ public bool updateModel(Vector3 to) { bool inProgress = controller.computeTargetedControl(vehicle.transform.forward, vehicle.transform.position, to); TargetedControllerResult res = controller.getOutput(); vehicle.transform.rotation = Quaternion.LookRotation(res.direction); vehicle.rigidbody.velocity = res.velocity * vehicle.transform.forward * MyUtils.movementK * Time.deltaTime; return(inProgress); }