Hey everyone!
I am currently developing an AI demo for a fighting game.
I wrote an OnTriggerEnter
function that detects fists or kicks; however it detecs actions if and only if the character move.
For example, I kick the other character, and my character’s leg enters, and exits the collider but, OnTriggerEnter
is not called in this scenario until I move my character.
How can I solve this problem?
Thank you!
Here is my code:
function OnTriggerEnter(collision : Collider)
{
if( collision.gameObject.name == "AI_Arm" || collision.gameObject.name == "AI_Leg" )
{
Debug.Log("PLAYER HIT!");
}
}
P.S: I used other version of the "OnTrigger
"s but, it remains same.