游戏对象运动的本质是游戏对象每一帧在空间上的变化,例如位置发生变化(Position),或者发生了旋转(Rotation)。
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Behavior : MonoBehaviour {// Use this for initializationvoid Start () {}private float verticalSpeed = 0.00f;public float horizontalSpeed = 5.00f;const float g = 0.098f;// Update is called once per framevoid Update () {Vector3 change = new Vector3 (Time.deltaTime * horizontalSpeed, -Time.deltaTime * verticalSpeed, 0.0f);ansform.position += change;verticalSpeed += g;}}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Behavior : MonoBehaviour {// Use this for initializationvoid Start () {}private float verticalSpeed = 0.00f;public float horizontalSpeed = 5.00f;const float g = 0.098f;// Update is called once per framevoid Update () {Vector3 change = new Vector3 (Time.deltaTime * horizontalSpeed, -Time.deltaTime * verticalSpeed, 0.0f);ansform.Translate (change);verticalSpeed += g;}
}
using Syst
本文发布于:2024-01-27 18:55:35,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/17063529352012.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |