unity中摄像机如何更随人物
2个回答
展开全部
正上方跟随:
using UnityEngine;
using System.Collections;
public void Following:MonoBehaviour
{
public float Ox;//偏差值
public float smooth=1;//缓动系数,默认为1,如有需要请在引擎中调试
public Transform ObjectPosition;//物体的位置
public Transform TargetPosition;//相机的移动目标位置
void Awake()
{
follow = GameObject.FindWithTag ("Object").transform;
}
void Update()
{
TargetPosition=(ObjectPosition.position+Vector3.up*Ox);//Ox具体是什么值在引擎里面调试
transform.position=vector3(transform.position,TargetPosition,Time.deltaTime*smooth);
transform.LookAt(ObjectPosition);
}
}
正前方上跟随:using UnityEngine;
using System.Collections;
public void Following:MonoBehaviour
{
public float Ox;//偏差值
public float smooth=1;//缓动系数,默认为1,如有需要请在引擎中调试
public Transform ObjectPosition;//物体的位置
public Transform TargetPosition;//相机的移动目标位置
void Awake()
{
follow = GameObject.FindWithTag ("Object").transform;
}
void Update()
{
TargetPosition=(ObjectPosition.position+Vector3.up*Ox)+(ObjectPosition.position+vector3.forward*Ox);//Ox具体是什么值在引擎里面调试
transform.position=vector3(transform.position,TargetPosition,Time.deltaTime*smooth);
transform.LookAt(ObjectPosition);
}
}
正后上方跟随:
using UnityEngine;
using System.Collections;
public void Following:MonoBehaviour
{
public float Ox;//偏差值
public float smooth=1;//缓动系数,默认为1,如有需要请在引擎中调试
public Transform ObjectPosition;//物体的位置
public Transform TargetPosition;//相机的移动目标位置
void Awake()
{
follow = GameObject.FindWithTag ("Object").transform;
}
void Update()
{
TargetPosition=(ObjectPosition.position+Vector3.up*Ox)+(ObjectPosition.position-vector3.forward*Ox);//Ox具体是什么值在引擎里面调试
transform.position=vector3(transform.position,TargetPosition,Time.deltaTime*smooth);
transform.LookAt(ObjectPosition);
}
}
using UnityEngine;
using System.Collections;
public void Following:MonoBehaviour
{
public float Ox;//偏差值
public float smooth=1;//缓动系数,默认为1,如有需要请在引擎中调试
public Transform ObjectPosition;//物体的位置
public Transform TargetPosition;//相机的移动目标位置
void Awake()
{
follow = GameObject.FindWithTag ("Object").transform;
}
void Update()
{
TargetPosition=(ObjectPosition.position+Vector3.up*Ox);//Ox具体是什么值在引擎里面调试
transform.position=vector3(transform.position,TargetPosition,Time.deltaTime*smooth);
transform.LookAt(ObjectPosition);
}
}
正前方上跟随:using UnityEngine;
using System.Collections;
public void Following:MonoBehaviour
{
public float Ox;//偏差值
public float smooth=1;//缓动系数,默认为1,如有需要请在引擎中调试
public Transform ObjectPosition;//物体的位置
public Transform TargetPosition;//相机的移动目标位置
void Awake()
{
follow = GameObject.FindWithTag ("Object").transform;
}
void Update()
{
TargetPosition=(ObjectPosition.position+Vector3.up*Ox)+(ObjectPosition.position+vector3.forward*Ox);//Ox具体是什么值在引擎里面调试
transform.position=vector3(transform.position,TargetPosition,Time.deltaTime*smooth);
transform.LookAt(ObjectPosition);
}
}
正后上方跟随:
using UnityEngine;
using System.Collections;
public void Following:MonoBehaviour
{
public float Ox;//偏差值
public float smooth=1;//缓动系数,默认为1,如有需要请在引擎中调试
public Transform ObjectPosition;//物体的位置
public Transform TargetPosition;//相机的移动目标位置
void Awake()
{
follow = GameObject.FindWithTag ("Object").transform;
}
void Update()
{
TargetPosition=(ObjectPosition.position+Vector3.up*Ox)+(ObjectPosition.position-vector3.forward*Ox);//Ox具体是什么值在引擎里面调试
transform.position=vector3(transform.position,TargetPosition,Time.deltaTime*smooth);
transform.LookAt(ObjectPosition);
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询