Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //box cast extents are the same as would be used in Physics.BoxCast
- //hitPoint is the RaycastHit.point returned from the boxcast
- Vector3 upperLeft, upperRight, lowerLeft, lowerRight;
- upperLeft = new Vector3(
- transform.position.x - 0.5f * boxCastExtents.x,
- transform.position.y + 0.5f * boxCastExtents.y,
- transform.position.z);
- upperRight = new Vector3(
- transform.position.x + 0.5f * boxCastExtents.x,
- transform.position.y + 0.5f * boxCastExtents.y,
- transform.position.z);
- lowerLeft = new Vector3(
- transform.position.x - 0.5f * boxCastExtents.x,
- transform.position.y - 0.5f * boxCastExtents.y,
- transform.position.z);
- lowerRight = new Vector3(
- transform.position.x + 0.5f * boxCastExtents.x,
- transform.position.y - 0.5f * boxCastExtents.y,
- transform.position.z);
- Vector3 upperLeft1, upperRight1, lowerLeft1, lowerRight1;
- upperLeft1 = new Vector3(
- hitPoint.x - 0.5f * boxCastExtents.x,
- hitPoint.y + 0.5f * boxCastExtents.y,
- hitPoint.z);
- upperRight1 = new Vector3(
- hitPoint.x + 0.5f * boxCastExtents.x,
- hitPoint.y + 0.5f * boxCastExtents.y,
- hitPoint.z);
- lowerLeft1 = new Vector3(
- hitPoint.x - 0.5f * boxCastExtents.x,
- hitPoint.y - 0.5f * boxCastExtents.y,
- hitPoint.z);
- lowerRight1 = new Vector3(
- hitPoint.x + 0.5f * boxCastExtents.x,
- hitPoint.y - 0.5f * boxCastExtents.y,
- hitPoint.z);
- Debug.DrawLine(upperLeft, upperLeft + 100f * transform.forward, color, 1.25f * Time.deltaTime);
- Debug.DrawLine(upperRight, upperRight + 100f* transform.forward, color, 1.25f * Time.deltaTime);
- Debug.DrawLine(lowerLeft, lowerLeft + 100f * transform.forward, color, 1.25f * Time.deltaTime);
- Debug.DrawLine(lowerRight, lowerRight + 100f * transform.forward, color, 1.25f * Time.deltaTime);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement