Unity射线检测鼠标点击坐标.pdfVIP

  • 1
  • 0
  • 约1.84千字
  • 约 2页
  • 2026-05-09 发布于北京
  • 举报

射线检测并获得鼠标点击的坐标[x,y,z]

发布于2013年05月26日由U3d/Unity3D/插件/被围观175次

01usingUnityEngine;

02

03usingSystem.Collections;

04

05publicclass卢:MonoBehaviour

06

07{

08

09public机cam;

10

11//我们需要实际一个对象

12

13射线碰撞hittnew射线碰撞();

14

15//使用此方法进行初始化

16

17void开始()

18

19{

20

21}

22

23//每帧调用一次Update方法

24

25void更新()

26

27{

28

29射线raycam.ScreenPointToRay(输入.鼠标位置);

30

31.射线检测(ray,outhitt,100);

32

33//Debug.DrawLine(cam.transform.position,ray.direction,Color.red);

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档