Instantly share code, notes, and snippets.

What would you like to do?
Vector2 screenCenterPoint = new Vector2(Screen.width/2, Screen.height/2);
_ray = Camera.main.ScreenPointToRay(screenCenterPoint);
if(Physics.Raycast(_ray, out _hit, Camera.main.farClipPlane) && _bulletHole != null)
Vector3 bulletHolePosition = _hit.point + _hit.normal * 0.01f;
Quaternion bulletHoleRotation = Quaternion.FromToRotation(-Vector3.forward, _hit.normal);
GameObject hole = GameObject.Instantiate(_bulletHole, bulletHolePosition, bulletHoleRotation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment