Unity3D物理射线和碰撞.docVIP

  • 22
  • 0
  • 约 5页
  • 2016-12-11 发布于重庆
  • 举报
1 Camera:包含两个方法跟射线有关系 using UnityEngine; using System.Collections; public class example : MonoBehaviour {void Update() {Ray ray = camera.ScreenPointToRay(new Vector3(200, 200, 0));Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow);} } using UnityEngine; using System.Collections; public class example : MonoBehaviour {void Update() {Ray ray = camera.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));RaycastHit hit;if (Physics.Raycast(ray, out hit))print(Im looking at + hit.transform.name);elseprint(Im looking at nothing!);} } 2 Collider:有一个方法 // pragma below is needed due to a Unit

文档评论(0)

1亿VIP精品文档

相关文档