コード例 #1
0
    /// <summary>
    /// takes the mouse position and casts a ray from the screen point to the plane created in the awake method,
    /// if the ray hits something then it gets that point in world space and passes it to the
    /// characterAnimationController for rotation adn the LightFollowsMouse to move the light to that point
    /// </summary>
    private void MouseInputPlaneCast()
    {
        if (!_isMainNotNull)
        {
            return;
        }
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (!plane.Raycast(ray, out var distance))
        {
            return;
        }
        var point = ray.GetPoint(distance);

        characterAnimations.RotateTowardsPoint(point);
        mousePointLight?.LightMovesToPoint(point);
    }