1. 简答题
- 游戏对象运动的本质是什么?
游戏对象运动的本质是其transform属性的position、rotation和scale等属性的变化。
- 请用三种方法以上方法,实现物体的抛物线运动。(如,修改Transform属性,使用向量Vector3的方法…)
1. 通过transform.Translate方法
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour {
private Vector3 g;
private Vector3 vy;
private Vector3 vx;
private float t;
// Use this for initialization
void Start()
{
t = Time.deltaTime;
g = new Vector3(0, 9.8f, 0);
vy = new Vector3(0, 0, 0);
vx = new Vector3(0, 0, 30);
}
// Update is called once per frame
void FixedUpdate()
{
Vector3 target = (vy + vx) * t;
transform.Translate(target);
vy -= g * t;
}
}
2. 通过Vector3.MoveTowards方法

本文介绍了使用Unity3D实现游戏对象运动,包括物体的抛物线运动及构建太阳系模拟。在太阳系模拟中,行星围绕太阳以不同速度和角度旋转。此外,还详细解析了谜题游戏《Priests and Devils》的规则,列出游戏对象和玩家动作表,并提出了游戏对象预制、集合类型组织和遵循MVC结构的编程要求。
最低0.47元/天 解锁文章
2523

被折叠的 条评论
为什么被折叠?



