資源簡介
UNITY3D人物移動且攝像頭跟隨代碼
代碼片段和文件信息
using?System.Collections;
using?UnityEngine;
public?class?Player?:?MonoBehaviour
{
????//?Start?is?called?before?the?first?frame?update
????public?Transform?m_transform;
????Transform?m_camTransform;??????????????????????//攝像機Transform
????CharacterController?m_ch;??????????????????????//角色控制組件
????Vector3?m_camRot;
????float?m_movSpeed?=?3.0f;???????????????????????//角色移動速度
????float?m_gravity?=?2.0f;????????????????????????//重力
????float?m_camHeight?=?1.4f;
????public?int?m_life?=?5;?????????????????????????//生命值
????void?Start()
????{
????????m_transform?=?this.transform;
????????m_ch?=?this.GetComponent();????//獲取角色控制組件
????????m_camTransform?=?Camera.main.transform;
????????m_camTransform.position?=?m_transform.TransformPoint(0?m_camHeight
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2597??2019-10-18?22:59??Pla
-----------?---------??----------?-----??----
?????????????????2597????????????????????1
- 上一篇:c# Halcon17.2 x64模板創建查找
- 下一篇:康軟人力資源管理系統源碼
評論
共有 條評論