Ejemplo n.º 1
0
    void OnMoveInput(Vector2 movement)
    {
        // convert input into 3D direction
        Vector3 absoluteMovement = new Vector3(movement.x, 0, movement.y);
        // convert direction to be relative to camera orientation
        Vector3 localMovement = InputHelper.
                                ConvertDirectionToCameraLocal(absoluteMovement, Camera.transform);

        // ensure y in unaffected by conversion
        localMovement.y = 0;

        _characterMotor.Move(localMovement);
        _characterMotor.Rotate(localMovement);
    }
    void OnMoveInput(Vector2 movement)
    {
        // convert 2D move input to 3D direction
        Vector3 absoluteMovement = new Vector3(movement.x, 0, movement.y);
        // convert direction to be relative to camera orientation
        Vector3 localMovement = InputHelper.
                                ConvertDirectionToCameraLocal(absoluteMovement, Camera.transform);

        // ensure y in unaffected by conversion
        localMovement.y = 0;

        // request movements from the motor
        _motor.RequestMove(localMovement);
        _motor.RequestTurn(localMovement);
    }