Unity - A计划(一年有效期) 扫二维码继续学习 二维码时效为半小时

(66评价)
价格: 1299.00元
1对1 答疑即时回复7天无理由退款30天价保提问必答

服务保障

1对1 答疑

提供专属的一对一在线答疑,快速答疑解惑。

即时回复

及时响应学习咨询,帮助解决问题。

7天无理由退款

购买后7天内可申请无理由退款。

30天价保

购买后30天内如遇降价,可申请价保。

提问必答

对于提问做到有问必答,帮您扫清学习过程中的种种障碍

零基础Unity5.2入门课程—进入Unity开发的奇幻世界:Roll A Ball通过代码控制移动
Romeo_lo39发起了问答2019-01-22
11
回复
393
浏览

我按照了视频敲代码的,但是小球却一直无法移动,不知道哪里出错了

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour{

    private Rigidbody rd;

    public int force = 5;

	// Use this for initialization
	void Start (){
      rd = GetComponent<Rigidbody>();
    }
	
	// Update is called once per frame
	void Update (){
      float h = Input.GetAxis("Horizontal");
      float v = Input.GetAxis("Vertical");
      rd.AddForce( new Vector3(h,0,v) * force );
	}
}

 

所有回复
发表回复
你还没有登录,请先 登录或 注册!