csharp 团结,光线投射,bulletholes.cs

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 团结,光线投射,bulletholes.cs相关的知识,希望对你有一定的参考价值。

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);
    hole.transform.SetParent(_hit.transform);
}

以上是关于csharp 团结,光线投射,bulletholes.cs的主要内容,如果未能解决你的问题,请参考以下文章

csharp 遍历光线投射所有穿透的对象

csharp 光线投射

当物品掉到地上时,团结光线打击三次

用于游戏开发和其他目的的光线投射教程

用于游戏开发和其他目的的光线投射教程

用于游戏开发和其他目的的光线投射教程