#How do you make an ai collide with walls?
48 messages · Page 1 of 1 (latest)
You could make the object physical
its too much ink thats the issue
Video: http://dai.ly/x2eg86k
Download link.
Pathfinding system that uses the Raycast function. Variables used:
-marginCollision: The distance that...
Does an invisible collision not work? Or am I just stupid?
it probably does but then the ai wont go to the players it will continuously try go through a wall
i don't know what cv2 to use when it says
if(Vector3.Angle(temp,forward)<90f) this.escapeDirection = temp;
I’m still trying to figure it out too this is just what people have been using
oh ok cheers
Also if you just want the ai to stop at walls and don’t care abt pathfinding just have a trigger volume and if objects in it are greater than( however many objects are on the ai) then it stops
Also make sure they reverse away from the walls or they’ll get stuck there
Man I haven’t done this in a while lol
ye i also need pathfinding so it doesn't always follow the player
cheers for the help
Vector3.Angle function calculates the angle (degrees) between two points (vectors). The 90f means the number 90, as a float. The ‘temp’ value is calculated earlier in the code and forward is as well. The recreate Vector3.Angle with cv2… see attachment. I’ll pull up my in game version shortly.
The min/max chips are redundant, but they will eliminate rounding accidents due to floating point operations. They can likely be eliminated to save some heat
i also just tried the whole circuits but i think i have to of done something wrong let me get a video and show what happens
The algorithm is far from perfect, but I think you may have an error somewhere for it to make that poor turn away.
probably the angle thing
This is what I have after translating that algorithm to cv2, with some minor modifications.
does it fully work
It works as well as the algorithm allows it too, but it isn’t a very intelligent algorithm. It can’t navigate too complex settings
oh fair
My bot navigates around most walls to get to me. But some wall patterns it goes back and forth.
that doesn't matter to much tho as it still works
i just got it kind of working but it some how escaped when there is no hole
I think it might be beneficial to use spherecast instead of Raycast.
Enemies have size to them, but Raycast checks for a single point of access, not an area
thats fair
how did you reverse the vectors
bcs i scaled mine by -1
but i don't know if thats how to do it
I think scaling it by -1 will work, but I instead multiplied it by a vector of -1, -1, -1
What is your marginCollision value set to?
2.2
Your step might be too large. You are taking large steps. Would need to see the circuitry tho
In the top right, there is an add chip. One of the values goes down-left out of view. What is it