- Home /
How to check if a enemy is moving up or down?
So I have a basic chasing script for an enemy but when the enemy is trying to go up a hill it will stop, so I'm trying to lower it's gravity when going up a hill and up it's gravity when going down. How would I go about doing this?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by theawesome1 · Oct 23, 2020 at 03:57 AM
  if (rb.velocity.y < -0.1)
         {
          //code goes here for falling
         }
  if (rb.velocity.y > -0.1)
         {
           // I think, but I am not sure if the code will work here when you are going up
         }
Your answer
 
 
             Follow this Question
Related Questions
Rabit movement animation and coding problem 1 Answer
I can't give damage with these scripts 2 Answers
Instantiated object not showing in scene or hierarchy 2 Answers
how to let an object drive on a road? 1 Answer
Character not moving on Unity 5 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                