- Home /
Link two nodes with a edge
Hello, so to preface this question. I am creating a custome navigation system for my game and have hit a road block. I am at a point where I have my 'nodes' which I will use as part of my path finding, but now I need some way to link them and to give that link a weight.
My nodes are just created with empty game objects that my player can move towards, but I am not sure how to represent the edge weights between any given two nodes.
My nodes have a unique ID that I can reference later, and with that in mind here is a basic picture of what I am trying to accomplish.
UID = 0 Edge (Weight = 1) UID = 1
[Node1] --------------------------- [Nodes2]
Answer by RudyTheDev · Feb 11, 2014 at 10:33 AM
There are many ways to do this.
You can have a Node script on each node and store neighbours/weights there.
You can have a Node Map/List script and store all relations there (for example, in your path-finding script).
You can have Edge GameObjects with scripts and store nodes there (or Edge map/list script).
You can, in fact, do all this without game objects for performance, all of this depends on how the rest of your game is structured.
Hey $$anonymous$$, so I am still working on this properly. Currently I have a few nodes set up around each other, but I am having problems figuring out a way to detect the nodes that are around each given node. Any suggestions?
That really depends on how you ended up doing this. What do you mean by "detect" -- are you not making the connections yourself?
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Object reference not set to instance of object - Can't find solution. 1 Answer
Making my own navmesh 1 Answer
Make a flying enemy ? 0 Answers
Multiple Cars not working 1 Answer