查看: 1039|回复: 0
打印 上一主题 下一主题

动态加载网上或者本地场景问题

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-2-2 15:22:12 |只看该作者 |倒序浏览
射线检测  射线碰到碰撞体后会返回一个检测信息 包含碰到的物体的名字之类,就是返回一个引用型的变量,这个变量就可以当做你射到那个物体来用。1、使用Camera.ScreenPointToRay得到一条射线,2、然后使用射线检测函数Physics.Raycast,然后会得到RaycastHit 信息,根据信息可以判断你到底点中了什么。Camera.ViewportPointToRay 也行不过这个是基于视口的,超出了你的程序框框就无效。

var gui : GUITexture;
  var find : GUITexture;
  //var GameObjectName;
function Awake(){
    find=GameObject.Find("guiTexture").GetComponent(GUITexture);
    find.enabled=false;
}

function OnMouseDown()
{
    //find=GameObject.Find("guiTexture").GetComponent(GUITexture);
    find.enabled=***e;
    Debug.Log(gameObject.name);
    www(gameObject.name);
}

function www(Cubename){
// Store the original pixel inset
// and modify it from there.
var originalPixelRect = gui.pixelInset;

// Update the progress bar by scaling the gui texture
// until we reach the end
var stream=new WWW(""+Cubename+".unity3d");
while (!stream.isDone)
{
gui.pixelInset.xMax = originalPixelRect.xMin
+ stream.progress * originalPixelRect.width;
yield;
}
// Update it one last time before loading
gui.pixelInset.xMax = originalPixelRect.xMax;
stream.LoadUnityWeb();
}
@script RequireComponent (GUITexture)



转自unity3D中文学习社区
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-5-6 01:24 , Processed in 0.086768 second(s), 32 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部