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.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
Post a Comment