Hi community! I wrote this code:
promien = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(promien, out trafienie, 100, shootable))
{
Transform point = trafienie.collider.GetComponent<Transform>();
if (//gameObject isn't looking at point position)
{
transform.LookAt(point.position);
}
anim.SetBool("Shoot", true);
Health enemy = trafienie.collider.GetComponent<Health>();
if (enemy.health != 0)
{
enemy.Damage(fireDamage);
}
}
And I don’t know what should I write in the place of condition of this if structure. I want to do this because my player is trying to look at the “point” object even if he is already looking at it causing a weird wiggle bug. Please help me. Thanks!