I’m trying to script it to where there is a chance that when a character’s chest collider (for example) is hit by a raycast, a specific animation might play. I think I’m doing it wrong, though. Using this as a test:
if(hit.collider.CompareTag("EnemyChest")){
if(Random.value < 0.75f){
Debug.Log("Chest animation!");
}
}
I figured that line of script would say “if the random.value is greater than 75%, play animation” but it returns positive after every hit. Even if I lower the value down to 0.1. What am I misunderstanding here?