calculate what angle should the turret fire with a rigibody bullet [C#]
I got 3 variable bullet drag, bullet speed, and the distance between the target end the turret. i want the function return the angle should the turret aim at.
Comment
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GunTilting : $$anonymous$$onoBehaviour {
public float speed = 1.0f;
public GameObject aimTarget;
void Update () {
float targetDistance = Vector3.Distance(transform.position, aimTarget.transform.position);
//tillGun by Y rotation
}
void aimAngle(float horizontalDrag, float targetDistance, float projectileSpeed ) {
// some calculate
return aimAngle
}
}