protected bool CheckForBlockOrientatorAndApply(RaycastHit hit) { IBlockPlaceOrientator orientator = hit.collider.gameObject.GetComponent <IBlockPlaceOrientator>(); if (orientator == null) { return(false); } AssignToOrientation(orientator, hit); return(true); }
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); }