unity3d摄像机跟随物体
2015-12-30 20:34
543 查看
using UnityEngine;
using System.Collections;
public class FolloePlayer : MonoBehaviour {
private Vector3 offset;
public Transform trsPlay;
void Awake () {
offset = transform.position - trsPlay.position;
offset = new Vector3(0, offset.y,offset.z);
}
void Update () {
print(transform.position);
print(trsPlay.position);
this.transform.position = trsPlay.position + offset;
}
}
using System.Collections;
public class FolloePlayer : MonoBehaviour {
private Vector3 offset;
public Transform trsPlay;
void Awake () {
offset = transform.position - trsPlay.position;
offset = new Vector3(0, offset.y,offset.z);
}
void Update () {
print(transform.position);
print(trsPlay.position);
this.transform.position = trsPlay.position + offset;
}
}
相关文章推荐
- Unity3D研究院之IOS全自动编辑framework、plist、oc代码(六十七)
- Unity中数据序列化
- A星寻路算法之RVO动态寻路
- 【小松教你手游开发】【unity实用技能】unity 更漂亮的位移
- 开始学习Unity
- unity生成android release 版本的apk性能比较好
- unity set texture offset
- Unity3D-对象池GameObjectPool
- (2016-1-5更新)unity3d Hair real time rendering _ An Energy-Conserving Hair Reflectance Model
- unity 场景的制作prefab 摆东西
- unity 2048 noplaymaker text
- unity playmaker player
- Unity3D游戏开发之如何优化贴图占用内存
- unity admob
- unity xml加密解密源码
- Unity Mesh Filter 与 Mesh Renderer
- unity制作2d游戏(捕鱼达人)优化
- 混音器(AudioMixer):用Unity 5.0混合出美妙节拍
- Unity导出的Xcode工程目录
- Unity2D实现贴图凹凸感并接受实时光照效果