本文主要是介绍Unity3D 运动之Move函数和translate,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
CharacterController.Move 移动
function Move (motion : Vector3) : CollisionFlags
Description描述
A more complex move function taking absolute movement deltas.
一个更加复杂的运动函数,每次都绝对运动。
Attempts to move the controller by motion, the motion 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的碰撞的概要。这个函数不应用任何重力。
- C#
This script moves the character controller forward // and sideways based on the arrow keys. //这个脚本用箭头键向前移动和侧移角色控制器。 // It also jumps when pressing space. //当按下空格键时,它跳起。 // Make sure to attach a character controller to the same game object. //确保把一个character controller组件附加到同一个游戏物体上。 //It is recommended that you make only one call to Move or SimpleMove per frame. //建议你每帧只调用一次Move或者SimpleMove。 public class example : MonoBehaviour { public float speed = 6.0F; public float jumpSpeed = 8.0F; public float gravity = 20.0F; private Vector3 moveDirection = Vector3.zero; void Update() { CharacterController controlle
- C#
这篇关于Unity3D 运动之Move函数和translate的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!