CharacterController 中Move 和 SimpleMove的区别分析

  • CollisionFlags Move(Vector3 motion);

Description

A more complex move function taking absolute movement deltas;

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函数并不使用重力。

  • bool SimpleMove(Vector3 speed);

Description

Moves the charactor with speed.

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.

Y轴的速度将会被忽略。速度单位时米每秒。重力自动生效。返回值是角色是否着地(bool),建议每帧调用一次Move或者SimpleMove。

最近做了一个小项目,讲师又给我们介绍了一种新的控制人物移动的方法:CharacterController,主要用于人物模型的移动,主要是Move和Simple Move两个方法。

今天使用SimpleMove的时候,人物并不能移动,后来才发现我是这样写的:SimpleMove(transform.forword * speed *time.deltatime); 找错还找了好久,后来才发现,speed*time.deltatime是什么鬼,m/s * m/s = (不知道) qwq;所以后面参数直接是速度就OK;

原文地址:https://www.cnblogs.com/1217224194-jiang/p/6554565.html