个人开发网站,怎样申请电子邮箱,个人社团网站怎么做,帮别人做非法网站平面来触发碰撞#xff0c;胶囊用红色材质方便观察。 脚本挂载到胶囊上方便操作。 目前实现的功能#xff0c;鼠标左键点击#xff0c;胶囊就移动到那个位置上。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class c6 : MonoBe… 平面来触发碰撞胶囊用红色材质方便观察。 脚本挂载到胶囊上方便操作。 目前实现的功能鼠标左键点击胶囊就移动到那个位置上。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class c6 : MonoBehaviour
{// Start is called before the first frame updatevoid Start(){}// Update is called once per framevoid Update(){// 鼠标左键if (Input.GetMouseButtonDown(0)){// 摄像头发送射线Ray ray Camera.main.ScreenPointToRay(Input.mousePosition);// 碰撞信息类RaycastHit hit;// 碰撞类检测bool res Physics.Raycast(ray, out hit);// 如果碰撞到了hit就有内容了if (res true){Debug.Log(hit.point);// 将射线碰撞到的坐标给到球的坐标transform.position hit.point;// 多检测返回检测后碰撞的数组参数是否、距离、图层、// RaycastHit[] hits Physics.RaycastAll(ray, 100, 1 10);// Debug.Log(hits);}}}
}