小白求教,unity3d 安卓做安卓游戏,安装,打开后不显示模型

小白求教,怎么判断我点击了物体的哪个面【unity3d吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:77,207贴子:
小白求教,怎么判断我点击了物体的哪个面收藏
事情是这样的,我想实现一个功能,就是点击正方体的正面,就在正面的方向在生成一个正方体,在点击侧面,又在侧面生成一个正方体,研究一下午了,求指导,在线等
学术会议举办竟然如此轻松?原来是找了这家会展公司!
一个方法,仅仅针对楼主所说的正方形using UnityEusing System.Cpublic class test : MonoBehaviour {
public GameO
public float distance = 1;// Use this for initializationvoid Start () {
Debug.LogError(&obj对象为null&);
if (obj.GetComponent&Collider&())
Destroy(obj.GetComponent&Collider&());
}}// Update is called once per framevoid Update () {
if (Input.GetMouseButtonDown(0))
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 1000))
Vector3 orign=hit.collider.bounds.
Vector3 hitPoint = hit.
Vector3 hitPointLocal = hit.collider.gameObject.transform.InverseTransformPoint(hitPoint);
float x = Mathf.Abs(hitPointLocal.x);
float y = Mathf.Abs(hitPointLocal.y);
float z = Mathf.Abs(hitPointLocal.z);
if (x & 0.5) { hitPointLocal = new Vector3(0,hitPointLocal.y,hitPointLocal.z); }
if (y & 0.5) { hitPointLocal = new Vector3(hitPointLocal.x, 0,hitPointLocal.z); }
if (z & 0.5) { hitPointLocal = new Vector3(hitPointLocal.x, hitPointLocal.y,0); }
hitPoint = hit.collider.gameObject.transform.TransformPoint(hitPointLocal);
Vector3 direction =Vector3.Normalize(hitPoint - orign);
Vector3 spwanPoint = hitPoint + direction *
Instantiate(obj,spwanPoint,hit.collider.gameObject.transform.rotation);
原理:获取点击在物体上的点。将改点坐标转化为相对于物体的坐标。将该点坐标校正到对应面中心点。将该点转化为世界坐标。
明显小白不适合做这个功能。看楼上
登录百度帐号推荐应用小白求教,有一个unity3d文件怎么用网页打开?_unity3d吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:77,207贴子:
小白求教,有一个unity3d文件怎么用网页打开?收藏
UnityWebPlayer怎么使用?
登录百度帐号推荐应用}

我要回帖

更多关于 unity3d安卓真机调试 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信