物体标注源码.doc

上传人:sk****8 文档编号:3243394 上传时间:2019-05-26 格式:DOC 页数:2 大小:26.50KB
下载 相关 举报
物体标注源码.doc_第1页
第1页 / 共2页
物体标注源码.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、var target : Transform; / Object that this label should followvar offset = Vector3.up; / Units in world space to offset; 1 unit above object by defaultvar clampToScreen = false; / If true, label will be visible even if object is off screenvar clampBorderSize = .05; / How much viewport space to leave

2、 at the borders when a label is being clampedvar useMainCamera = true; / Use the camera tagged MainCameravar cameraToUse : Camera; / Only use this if useMainCamera is falseprivate var cam : Camera;private var thisTransform : Transform;private var camTransform : Transform;function Start () thisTransf

3、orm = transform;if (useMainCamera)cam = Camera.main;elsecam = cameraToUse;camTransform = cam.transform;function Update () if (clampToScreen) var relativePosition = camTransform.InverseTransformPoint(target.position);relativePosition.z = Mathf.Max(relativePosition.z, 1.0);thisTransform.position = cam

4、.WorldToViewportPoint(camTransform.TransformPoint(relativePosition + offset);thisTransform.position = Vector3(Mathf.Clamp(thisTransform.position.x, clampBorderSize, 1.0-clampBorderSize),Mathf.Clamp(thisTransform.position.y, clampBorderSize, 1.0-clampBorderSize),thisTransform.position.z);else thisTransform.position = cam.WorldToViewportPoint(target.position + offset);script RequireComponent(GUIText)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育教学资料库 > 精品笔记

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。