If statement for direction the character is facing
I'm basically setting up where my character will attack with his melee weapon, but at the moment i can't figure out how to implement the second box collider. Basically, i have the first one set up which is always on the right hand side of the character and will always attack there when i press the attack button, so the collider shows only on the right side.. I'm basically trying to figure out if there is a way to do such -
 if (characterFacingDirection && isAttacking = Left)
     {
           attackBoxLeft = true;
     }
It's the same with the right side. I know that code is useless, it's just to stress my point on what i'd like to happen without typing out in a block of text.
you can cheek if character transform.position.x is than the other object transform.position.x & then apply different cod depending on that for example :
 public Transform Enemy;
 void Update(){
     if(transform.position.x < Enemy.transform.position.x){
        // attack Right 
     }
     else if (transform.position.x > Enemy.transform.position.x){
         // attack Left
     }
 }
Your answer
 
 
             Follow this Question
Related Questions
Add changeable conditions in the editor, similar to unityEvent? 0 Answers
SqrMagnitude intermittently doesn't work for if statement on prefab. (C sharp) 1 Answer
The If statement condition is false but the if statement stills executes 1 Answer
Help with rotation please 2 Answers
Unity Update is ignoring the GetKey part of my statement!? 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                