|
| 22 Apr 2013 10:11 PM |
Alright, so I've been reading about pathfinding and A* , I think I understand the concept for the most part, currently I've decided upon using a non-grid based set of nodes that I place strategically throughout the map and then cast rays to connect the nodes and store them in a 2d table. A visual of how the table is set up:
{{origin(x,y,z),pos(x,y,z),pos(x,y,z)},{origin(x,y,z),pos(x,y,z),pos(x,y,z)}}
As you can see the nodes are only refered to by their position, meaning I can’t check adjacent nodes of the nodes stored in the 2nd table. How would I properly reference the nodes in the table?
Here's the script if you need it: pastebin.com/xgwQ2Ete
|
|
|
| Report Abuse |
|
|
rockman5
|
  |
| Joined: 17 Oct 2008 |
| Total Posts: 2852 |
|
|
| 22 Apr 2013 11:04 PM |
Easy fix....do:
{{origin(x,y,z),pos(x,y,z),pos(x,y,z)},you actually thought i knew,{origin(x,y,z),pos(x,y,z),pos(x,y,z)}} |
|
|
| Report Abuse |
|
|
|
| 22 Apr 2013 11:08 PM |
| seems legit, However if I could find a way to store each node in the table as a magic variable that contains the information that the table currently holds (the positions of the nodes available from the point of the current node) |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 12:28 AM |
I have no idea what u r talking about....
I made a map once and Named the Nodes truncated-Positions (Rounded to the Nearest Integer with math.floor ("Zombie Brains AI" in Catalog (The rest of the script is deprecated)))
Once the numbers are 'handlable" like that, u can check for adjacency. U can use different size grids or 3D chessboards....
Here's a Better AI that uses Ray-casting:
Speed AI
--Brian
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 12:30 AM |
*Rounded to the Nearest Integer with math.floor...
after being divided by a 'grid size'. |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 23 Apr 2013 02:15 AM |
maybe an if statement would work?
newnode = nil targetpos = YourTargetPosition for i,v in pairs(YourTableWithNodes) do if v[1] == lastnode then newnode = v end end
I hope this works for you. You can't get more help in this really, because there aren't much people who understand pathfinding (me neither). So Good Luck!
Enjoy :)
~sycips~ |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 08:49 AM |
hmmm.... I think i can store the index of each node in the y axis of the vector, since i don't really need the y axis :3
Hopefully that will work, but I just woke up so i'll figure out if that will work later.
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 11:12 AM |
NOW, your cooking with gasoline!
I use the RotVelocity of anchored Parts to store Vector3s.... |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2013 01:11 PM |
smart idea there, also for anyone who wants to know, my idea worked :D nodeContainer[nodeContainer[2][1].y] now gives me the table of the node! |
|
|
| Report Abuse |
|
|