# So confusing with nodes

What i understand a node is a position of the parent which the node is lying in.
Then you can convert it to a pointer which points to the position, and for some odd reason this should be at use?!
A node is when two ropes node together and gets stuck.
What does that have to do with a position?!

Im extremly confused @_@

well…nodes are not positions. nodes are like… hm well nodes
try to imagine nodes as invisible objects. like boxes or so.
they can contain lots of different stuff. they can contain visible geometry, values like their own position,rotation, they can contain information about collisions and much more.

those “invisible boxes” or whatever you use to imagine them. can be arranged in trees. so each box can have a parent box, and none or more children-boxes.
for example:when you load a model, you’ll get a node, which contains another node with your actual model-geometry.

many of the parameters are passed down to children in some way.
positions and the like are relative to their parents positions.
colors get passed down and so on.

you might have done some node.setPos() already. this changes the position of a node. but there are many many more things you can do with nodes

i hope this explains it a little. if i add just more confusion just tell us we’ll try to explain it a little bit better.

Ok, i understand like:
-nodes are not boxes XD
-nodes isent an object, but still somehow it has position…?
-nodes can contain anything…?

have i missed or missunderstod something?

Bump

nothing fundamentally wrong with that. when you use panda for a little bit longer you’ll learn about what nodes are, and do but for now that’s pretty close to it. by far a more useful way to think about them than just imagine them as positions.

The concept of “node” is a very fundamental concept to graph theory, which is ubiquitous in computer science. Graphs and trees are used in implementing many, many important data structures, like linked lists and binary trees, and all of them use the concept of “node” in one way or another.

As you say, “A node is when two ropes node together and gets stuck.” Think of a fisherman’s net. It’s made of lots of ropes tied together into a grid. At each intersection point of two ropes crossing, the ropes are tied together in a little knot; this is a “node” of the net.

In a mathematical graph, which is a connection of lines in a mesh kind of like a net, each crossing point of lines is called a “node”. That’s what a “node” is in mathematics.

In the Panda scene graph, we use a graph to represent drawable objects. We call each drawable object in Panda a “node”. Then you can hook up nodes together by drawing lines between them and making a graph. You can also hook up empty nodes that aren’t themselves drawable; but these are used to connect other nodes together.

The top of the scene graph is an empty node called “render”. There’s nothing in render itself to be drawn, it’s just the starting point of the graph. When you load a model, the object you get back is a node. If you make the call:

``model.reparentTo(render)``

you have just drawn a line between render and your model. This connects your model into the scene graph, and means that Panda will start drawing it.

You can control the state and position of your model by setting attributes on your model’s node directly. For instance, you can change its position or orientation by calling model.setPos() or model.setHpr(). You can also change its texture or color by calling model.setTexture() or model.setColor().

If you don’t want to take advantage of the organizational power of Panda’s scene graph, you can stop there. You don’t really need to understand Panda’s scene graph to use Panda.

But, you can go deeper. Instead of hooking your node directly up to render, you can hook it up to another node, which is itself hooked up to render:

``````dummy = NodePath('dummy')
dummy.reparentTo(render)
model.reparentTo(dummy)``````

Now you’ve got three nodes in your graph: render, dummy, and model, and there is a line between render and dummy, and another line between dummy and model. The kicker here is that Panda propagates state and transforms down the graph (away from render), so that if you apply a setPos() on dummy, it automatically applies to model as well. If you also to a setPos() on model, then both transforms accumulate and apply together to the model. The same is true for setHpr(), setTexture(), setColor(), and most other operations you do on nodes.

This all means that you can group together models under a single node and move them together as a unit. For instance, if your had a spaceship model that you had to load as two separate pieces, a front half and a back half, you could attach both of them to “dummy” and just move dummy around, instead of having to move your two halves separately.

You can also do more advanced tricks like having Panda compute the total transform between any two nodes in the graph, especially the transform between render and your model (which is also called the worldspace transform of your model).

David

You may also find the Disney Video Lecture on this topic informative: Scene Graph

David

thanks all =)
Yea, you really helpt me understand nodes
Thanks =)
But reason why i dont listen to the disny tutorial is because the heavy ac sound in the bg makes it almoste impossible to hear…
And i usually dont sped 1 hour watching tutorials since then it feels like im in school again XD
Well now when i have your attention i just wana ask one thing:
You can do mmorpgs in panda3d right?

The first video has terrible sound quality (and the link even says as much). The remaining videos all have excellent sound quality.

Do you want to learn or don’t you?

If Disney’s Toontown Online and Disney’s Pirates of the Caribbean Online count as mmorpgs, yes.

David

Ok, il watch the other videos…
And kewlm that u can make mmorpgs XD
But one more question remains:
How come i couldnt access this site for about a week?!
This happens frekvently, why?

• i cant access this forum during that time either so any other forum u could suggest?

the server hosting panda3d has probems from time to time. this week we reached new record of 4 days downtime straight. i hope that they do something about it soon.