- Home /
Moving Forward With Physics
I'm trying to have my character move forward whenever he attacks. So far he successfully moves forward, but if there's something in front of him he goes through it. Any way to avoid this? I turn PushUp on when I need him to move forward, and Push() stops it after 0.5 seconds.
if(PushUp){
Push();
transform.Translate(0,0,5 * Time.deltaTime);
}
Comment
Best Answer
Answer by FLASHDENMARK · Jun 22, 2011 at 11:10 AM
I made the same mistake a little time ago.
What you want is include the physics engine when moving. For that you will need SimpleMove and/or Move. Those will include the physics engine and should prevent the object going through other objects.