镜头的由远到近的镜头拉近效果实现
2017-04-04 22:38
513 查看
给Main Camare添加脚本 MovieCamare (Scripts)
Description描述
Moves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
简单的说,向某方向移动物体多少距离。
If relativeTo is left out or set to Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo isSpace.World the movement is applied relative to the world coordinate system.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World 移动被应用相对于世界坐标系统。
function Update() {
// Move the object forward along its z axis 1 unit/second.
//沿着z轴1单位/秒,向前移动物体
transform.Translate(Vector3.forward * Time.deltaTime);
// Move the object upward in world space 1 unit/second.
//在世界坐标沿着y轴1单位/秒,向上移动物体
transform.Translate(Vector3.up * Time.deltaTime, Space.World);
}
• function Translate (x : float, y : float, z : float,relativeTo :Space =
Space.Self) : void
Description描述
Moves the transform by x along the x axis, y along the y axis, and z along the z axis.
移动变换由x沿着x轴,y沿着y轴,z沿着z轴。
If relativeTo is left out or set to
Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo isSpace.World
the movement is applied relative to the world coordinate system.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World
移动被应用相对于世界坐标系统。
• function Translate (translation :
Vector3, relativeTo :
Transform) : void
Description描述
Moves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
简单的说,向某方向移动物体多少距离。
The movement is applied relative to /relativeTo/'s local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.
移动被应用相对于(relativeTo :
Transform)的自身坐标系统。日光相对于为null,则移动被应用相对于世界坐标系统。
• function Translate (x : float, y : float, z : float,relativeTo :Transform) : void
Description描述
Moves the transform by x along the x axis, y along the y axis, and z along the z axis.
移动变换由x沿着x轴,y沿着y轴,z沿着z轴。
The movement is applied relative to /relativeTo/'s local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.
移动被应用相对于(relativeTo :
Transform)的自身坐标系统。日光相对于为null,则移动被应用相对于世界坐标系统。
right
The red axis of the transform in world space.
在世界空间坐标变换的红色轴。也就是x轴。
up
The green axis of the transform in world space.
在世界空间坐标变换的绿色轴。也就是y轴。
forward
The blue axis of the transform in world space.
在世界空间坐标变换的蓝色轴。也就是z轴。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MovieCamera : MonoBehaviour { public float speed = 10;//设置镜头拉近的速度,public可以在Unity界面中更改,private不可以。 private float endZ = -20; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(transform.position.z>endZ)//还没有达到目标位置,transform的使用方法在下面补充 { transform.Translate(Vector3.forward * speed * Time.deltaTime);//移动transform在translation的方向和距离。 } } }
TransForm的使用
http://blog.csdn.net/leo_wc/article/details/42871539点击打开链接Transform.Translate 平移
function Translate (translation : Vector3, relativeTo : Space = Space.Self) : voidDescription描述
Moves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
简单的说,向某方向移动物体多少距离。
If relativeTo is left out or set to Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo isSpace.World the movement is applied relative to the world coordinate system.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World 移动被应用相对于世界坐标系统。
function Update() {
// Move the object forward along its z axis 1 unit/second.
//沿着z轴1单位/秒,向前移动物体
transform.Translate(Vector3.forward * Time.deltaTime);
// Move the object upward in world space 1 unit/second.
//在世界坐标沿着y轴1单位/秒,向上移动物体
transform.Translate(Vector3.up * Time.deltaTime, Space.World);
}
• function Translate (x : float, y : float, z : float,relativeTo :Space =
Space.Self) : void
Description描述
Moves the transform by x along the x axis, y along the y axis, and z along the z axis.
移动变换由x沿着x轴,y沿着y轴,z沿着z轴。
If relativeTo is left out or set to
Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo isSpace.World
the movement is applied relative to the world coordinate system.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World
移动被应用相对于世界坐标系统。
function Update() { // Move the object forward along its z axis 1 unit/second. //沿着z轴每秒1单位向前移动物体 transform.Translate(0, 0, Time.deltaTime); // Move the object upward in world space 1 unit/second. //在世界坐标每秒1单位向上移动物体 transform.Translate(0, Time.deltaTime, 0, Space.World); }
• function Translate (translation :
Vector3, relativeTo :
Transform) : void
Description描述
Moves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
简单的说,向某方向移动物体多少距离。
The movement is applied relative to /relativeTo/'s local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.
移动被应用相对于(relativeTo :
Transform)的自身坐标系统。日光相对于为null,则移动被应用相对于世界坐标系统。
function Update() { // Move the object to the right relative to the camera 1 unit/second. //相对于摄像机每秒1单位向右移动物体 transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform); }
• function Translate (x : float, y : float, z : float,relativeTo :Transform) : void
Description描述
Moves the transform by x along the x axis, y along the y axis, and z along the z axis.
移动变换由x沿着x轴,y沿着y轴,z沿着z轴。
The movement is applied relative to /relativeTo/'s local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.
移动被应用相对于(relativeTo :
Transform)的自身坐标系统。日光相对于为null,则移动被应用相对于世界坐标系统。
function Update() { // Move the object to the right relative to the camera 1 unit/second. //相对于摄像机每秒1单位向右移动物体 transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform); }
right
The red axis of the transform in world space.
在世界空间坐标变换的红色轴。也就是x轴。
up
The green axis of the transform in world space.
在世界空间坐标变换的绿色轴。也就是y轴。
forward
The blue axis of the transform in world space.
在世界空间坐标变换的蓝色轴。也就是z轴。
相关文章推荐
- AngryBird简单开发实现(二),zoom in/out的实现以及镜头跟随效果
- unity3d 带缓冲的镜头拉近效果
- 如何在unity3d中实现AR镜头全包裹和AR镜头不包裹效果
- 十字弓,瞄准器视野拉近效果实现原理
- unity 实现了鼠标滚动放大和缩小物体暨拉近拉远相机的效果
- Unity3D Shdaer 实现镜头模糊效果[Shader]
- AVCapture中实现拉近拉远镜头
- unity3d 带缓冲的镜头拉近效果
- unity3d 带缓冲的镜头拉近效果
- UE4实现一个简单的炸弹爆炸与镜头振动效果
- jQuery实现为图片添加镜头放大效果的方法
- Unity 镜头拉近效果(带缓冲)
- AVfoundation中焦距的设置(slider实现拉近拉远镜头)
- 【Unity】代码实现视野的旋转和视野的拉近和拉远的效果
- Unity3D 实现镜头模糊效果
- AVCaptureDevice中通过调用VideoZoomFactor方法调整焦距实现拉近拉远镜头进行拍照录制视频(动画缩放画面,不闪屏)
- AVCapture中实现拉近拉远镜头
- unity3D鼠标滚轮来实现镜头拉近拉远及视角旋转
- (转)Ogre天龙八部2及鹿鼎记天空顶(Skydome)镜头眩光(Lens Flare)等效果的实现
- AVCapture中实现拉近拉远镜头