CharacterController 中Move 和 SimpleMove的區別分析

 

  • CollisionFlags Move(Vector3 motion);

Descriptionapp

A more complex move function taking absolute movement deltas;ide

Attempts to move the controller by mothon will only be constrained by collisions.It will slide along colliders. CollisionFlags is the summary of collisions that occurred during the Move.This function does not apply any gravity.函數

角色移動只受到碰撞約束。角色遇到碰撞時將會沿着碰撞盒滑動,返回值是移動過程當中遇到的碰撞信息的彙總(CollisionFlags),Move函數並不使用重力。spa

  • bool SimpleMove(Vector3 speed);

Descriptionorm

Moves the charactor with speed.ip

Velocity along the y-axis is ignored.Speed is in meters/s.Gravity is automatically applied.Returns if the character is grounded.It is recommended that you make only one call to Move or Simple per frame.ci

Y軸的速度將會被忽略。速度單位時米每秒。重力自動生效。返回值是角色是否着地(bool),建議每幀調用一次Move或者SimpleMove。it

 

最近作了一個小項目,講師又給咱們介紹了一種新的控制人物移動的方法:CharacterController,主要用於人物模型的移動,主要是Move和Simple Move兩個方法。io

今天使用SimpleMove的時候,人物並不能移動,後來才發現我是這樣寫的:SimpleMove(transform.forword * speed *time.deltatime); 找錯還找了很久,後來才發現,speed*time.deltatime是什麼鬼,m/s * m/s = (不知道) qwq;因此後面參數直接是速度就OK;function

相關文章
相關標籤/搜索