[UNITY][C#] Projectile by tosawat
Jan0
IEnumerator projectile(Transform trans, Vector3 from, Vector3 to, float height, float time)
{
trans.localPosition = from;
yield return null;
float Vx = (to.x – from.x) / time;
float Vy = 2 * height / (0.33f * time);
float A1 = -2f * height / Mathf.Pow(0.33f * time, 2);
float t = 0;
while (t <= 0.33f * time)
{
float deltaTime = Time.deltaTime;
float deltaSx = Vx * deltaTime;
Vy += A1 * deltaTime;
float deltaSy = Vy * deltaTime;
trans.localPosition = new Vector3(trans.localPosition.x + deltaSx, trans.localPosition.y + deltaSy);
t += deltaTime;
yield return null;
}
Vy = 0;
float A2 = -2f * (to.y – from.y – height) / Mathf.Pow(0.67f * time, 2);
while (t <= time)
{
float deltaTime = Time.deltaTime;
float deltaSx = Vx * deltaTime;
Vy -= A2 * deltaTime;
float deltaSy = Vy * deltaTime;
trans.localPosition = new Vector3(trans.localPosition.x + deltaSx, trans.localPosition.y + deltaSy);
t += deltaTime;
yield return null;
}
}
(ไทย) วิธีติดตั้ง Onesignal plug-in ใน Unity 2017 by joeskb
Jan0
Sorry, this entry is only available in ไทย.
(ไทย) การใช้ Effect Outer Glow สร้างเอฟเฟ็คเวทมนตร์ by Tua Poonsurapun
Jan0
Sorry, this entry is only available in ไทย.