Ok so im trying to make a moving car ai for a racing game, so i have it so when the card detects a wall on the right AND a wall it front of it, it turns left. But in order for this to work I need the logic gate to constantly have an output, but it’s not doing that…
[Please leave the link to the game when asking about a problem or for help]
They’re actually outputting multiple times, Its just the raycasting angles isn’t rotating with the object.
Also why it stopped is because the bottom raycast isn’t reaching the bottom wall anymore.
Another reason why this wouldn’t work is because you’re using 2 different walls. You would need several more raycasts to detect every angle for 2 different objects.
There are 2 solutions I can think of (and one of which I tried):
Rotate the raycast angles with the rotations of the objects.
And make a 1 wall objects that all 3 raycasts can detect.
Another problem is the angle lengths are too short, but too long (90) won’t let the object straiten up.
The object will running into/along the walls, but will be able to complete several laps.
I didn’t go any further than this, but a way to solve a better AI is to create another set of raycasts for
only when the object actually hits the walls.
Use 8 different raycasts to detect every angle that you could hit from the 2 walls.
You still may need to use 1 wall, but in a way this could help solve the problem in a different angle.