Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Camera.cameraToWorldMatrix 相机转世界矩阵
# [Camera](Camera.html).cameraToWorldMatrix 相机转世界矩阵 var *cameraToWorldMatrix* : [Matrix4x4](../Matrix4x4/Matrix4x4.html) *Description* 描述 Matrix that transforms from camera space to world space (Read Only). 从相机空间到世界空间的变换矩阵(只读)。 Use this to calculate where in the world a specific camera space point is. 使用这个来计算相机空间中的一个点在世界坐标中的什么位置上。 Note that camera space matches OpenGL convention: camera's forward is the negative Z axis. This is different from Unity's convention, where forward is the positive Z axis. 注意相机空间与 OpenGL 的约定时间;相机的前面为 Z 轴负方向。这不同于 Unity 的约定,向前为 Z 轴正向。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public float distance = -1.0F; void OnDrawGizmosSelected() { Matrix4x4 m = camera.cameraToWorldMatrix; Vector3 p = m.MultiplyPoint(new Vector3(0, 0, distance)); Gizmos.color = Color.yellow; Gizmos.DrawSphere(p, 0.2F); } } ``` ``` // Draw a yellow sphere in scene view at distance // units along camera's viewing direction. //在屏幕视图绘制一个黄色的球,以Distance单位,沿着相机所看方向 var distance : float = -1.0; function OnDrawGizmosSelected () { var m : Matrix4x4 = camera.cameraToWorldMatrix; var p : Vector3 = m.MultiplyPoint (Vector3(0,0,distance)); Gizmos.color = Color.yellow; Gizmos.DrawSphere (p, 0.2); } ```
da
2022年5月17日 13:23
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码