Fixed 2 bugs in one function

 Fixed 2 bugs in one function

    For a while I was having trouble with both having the kart not move towards the node while in the air and resetting the AI after being stuck for the 3 seconds. At first I was trying to do an OnCollision check for the AI. If it's colliding with the track and if not set a bool to false then turn off the movement but it didn't work and it would just stop in place. For the kart resetting after being stuck took the longest. I tried resetting the position if the kart is stuck at a certain rotation but then I was using the wrong variable to get what I want and there was a time the AI got stuck in an infinite loop in the air.

Uploading: 5580 of 5580 bytes uploaded.



    After a weeks of research, trial, and error I managed to fix both bugs by putting them in the FixedUpdate() function. I was already trying to make the kart not move if it's in the air but I guess I was doing it at the wrong spot for it to work properly. For the reset I didn't need to do so much work than I thought I did. I didn't think about making a raycast for directly below the kart and I can just copy and paste what I did in the FollowWayPoints() method into it's own. Doing this fixed my problem completely. 



Comments

Popular posts from this blog

Learning Navmeshes too late

Getting Controller Support Working (The Awesome Benefits of Unity new Input Manager)

Making A Level