在unity中控制物体移动代码
从获取键盘开始
通过控制物体的坐标来实现物体移动
public int step; //步长
public float velocity=0.35f; //速度
private int x;
private int y;
private Vector3 playerPos;
void Start()
{
InvokeRepeating("Move",0,velocity);
x=0;y=step;
}
void Update(
在unity中控制物体移动代码
从获取键盘开始
通过控制物体的坐标来实现物体移动
public int step; //步长
public float velocity=0.35f; //速度
private int x;
private int y;
private Vector3 playerPos;
void Start()
{
InvokeRepeating("Move",0,velocity);
x=0;y=step;
}
void Update(