private void Update() { foreach (var controller in aiList) { AICharacterInputs input = new AICharacterInputs(); float chaseDirection; if (playerToFollow.position.x > controller.transform.position.x) { chaseDirection = 1f; } else { chaseDirection = -1f; } if (Mathf.Abs(playerToFollow.position.x - controller.transform.position.x) < 0.4f) { chaseDirection = 0f; } var chaseInput = new Vector3(chaseDirection, 0f, 0f); input.MoveVector = chaseInput; input.lookAheadDistance = lookAheadDistance; controller.SetInputs(ref input); } }
public void SetInputs(ref AICharacterInputs inputs) { if (!isActive) { return; } _moveInputVector = inputs.MoveVector; _lookInputVector = _moveInputVector.normalized; _lookAheadDistance = inputs.lookAheadDistance; }
public void UpdateJustTurningInput() { // Apply inputs to character //_characterController.SetInputs(ref characterInputs); // Stop regular input, halt movement, and use GetFrameRotation to manually enforce the per-frame rotation AICharacterInputs inputs = new AICharacterInputs(); _characterController.SetInputs(ref inputs); _characterController.Motor.BaseVelocity = Vector3.zero; // _characterController.Motor.SetRotation(characterAC.GetFrameRotation()); // edit }
public void SetInputs(ref AICharacterInputs inputs) { _moveInputVector = inputs.MoveVector; _lookInputVector = inputs.LookVector; }