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的碰撞的概要。这个函数不应用任何重力。

  • 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() {
    		Characte
阅读终点,创作起航,您可以撰写心得或摘录文章要点写篇博文。去创作
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiao豇豆

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值