Example #1
0
    protected bool CheckForBlockOrientatorAndApply(RaycastHit hit)
    {
        IBlockPlaceOrientator orientator = hit.collider.gameObject.GetComponent <IBlockPlaceOrientator>();

        if (orientator == null)
        {
            return(false);
        }

        AssignToOrientation(orientator, hit);
        return(true);
    }
Example #2
0
    protected void AssignToOrientation(IBlockPlaceOrientator orientator, RaycastHit hit)
    {
        Vector3 normal;

        if (orientationMode == OrientationMode.WorldNormal)
        {
            normal = (hit.point - planetCenter.position).normalized;
        }
        else
        {
            normal = orientator.NormalFromRay(hit);
        }

        AlignToTriangle(normal, Vector3.forward);

        objectToPlace.Rotate(new Vector3(0, angleAroundNormal, 0), Space.Self);
    }