ゲームオブジェクトの動きの簡単な説明
-
ゲームオブジェクトの動きの性質は何ですか?
ゲームオブジェクトの動きは、実際には各フレームにおけるゲームオブジェクトの空間位置の変化です. 3D オブジェクトであるため、ここでの位置には、オブジェクトの 3 次元座標系だけでなく、オブジェクトの回転も含まれます.
-
オブジェクトの放物線運動を実現するために 3 つの方法を使用します。
放物線式
S y = vyt − gt 2 S_y = v_yt-gt^2Sy=vyt−ギット_2
S x = vxt S_x = v_xtS×=v×各瞬間
に x 軸と y 軸にΔ x ΔxΔx , ΔyΔyΔyの
3 つの方法は次のとおりです。using System.Collections; using System.Collections.Generic; using UnityEngine; public class Parabolic : MonoBehaviour { public float speed = 5; // 移动速度 // Use this for initialization void Start () { } // Update is called once per frame void Update () { Vector3 delta_vector = new Vector3(Time.deltaTime*5, -Time.deltaTime*(speed/10), 0); this.transform.position += delta_vector; speed++; } }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Parabolic : MonoBehaviour {
public float speed = 1;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector3 delta_vector = new Vector3(Time.deltaTime * 5, -Time.deltaTime * (speed / 10), 0);
transform.Translate(delta_vector);
speed++;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move1 : MonoBehaviour {
public float speed = 1;
// Use this for initialization
void Start () {
Debug.Log("start!");
}
// Update is called once per frame
void Update () {
this.transform.position += Vector3.down * Time.deltaTime * (speed/10);
this.transform.position += Vector3.right * Time.deltaTime * 5;
speed++;
}
}