/// <summary> /// Uses ballistic trajectory physics to determine the gravity and the impulse required to move the ball to the target position. /// </summary> public void Bowl() { if (BallisticPhysics.SolveBallisticArcLateral(transform.position, settings.speed, targetPosition, Vector3.zero, settings.launchArc, out Vector3 fireVel, out float gravity, out Vector3 impactPos)) { lastPos = transform.position; this.gravity = gravity; impulse = fireVel; isTrajectory = true; } }
//private GameObject outBoundaries; //private bool checkAABB = false; //private bool outsideAABB = false; //private bool targetAABB = false; void Start() { physicScript = gameObject.GetComponent <BallisticPhysics>(); //outBoundaries = GameObject.Find("AABB"); //checkAABB = false; powerBar = GameObject.Find("powerBar").GetComponent <powerBarScript>(); gameManager = GameObject.FindGameObjectWithTag("Game manager"); Invoke("DestroyProjectile", lifeTime); projectile = gameObject.GetComponent <Rigidbody>(); projectile.useGravity = false; if (gameManager.GetComponent <GameManager>().teamTurn == gameManager.GetComponent <GameManager>().playerTag) { target = gameManager.GetComponent <GameManager>().enemiesAlive[gameManager.GetComponent <GameManager>().selectedPlayerTarget]; } else if (gameManager.GetComponent <GameManager>().teamTurn == gameManager.GetComponent <GameManager>().enemiesTag) { target = gameManager.GetComponent <GameManager>().playerAvatarsAlive[gameManager.GetComponent <GameManager>().selectedEnemyTarget]; } Launch(); }