void ShowPreview()
    {
        RaycastHit hitInfo;

        if (Physics.Raycast(camTransform.position, camTransform.forward, out hitInfo, cameraRayLength))
        {
            preview.transform.position = placementGrid.GetNearestPointOnGrid(hitInfo.point) - Vector3.up * 0.45f;
            if (previewTower != null)
            {
                previewTower.transform.position = placementGrid.GetNearestPointOnGrid(hitInfo.point) + Vector3.up;
            }
        }
    }
예제 #2
0
    public Vector3 PlaceCubeNear(Vector3 clickPoint)
    {
        Vector3 finalPosition = grid.GetNearestPointOnGrid(clickPoint);

        return(finalPosition);
    }