/* Call the rotate function of Ship Components and pass the position of the enemy */ void turretRot() { if (targetEnemy != null) { shComps.turretRot(targetEnemy.transform.position); } }
/* Call the rotate function of Ship Components and pass the position of the mouse in world space */ void turretRot() { Ray mouse = mouseCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(mouse, out hit) && hit.collider.gameObject != this.gameObject) { shCmps.turretRot(hit.point); } }