Populating the SceneGraph

Hey there Monkeys!

Newbie here! I probably have kind of a stupid question, but I can’t wrap my head around this…

First of all: This is not about a game! Just a project regadring a scenegraph!

So what I did so far:
I’m just loading geometries into a scenegraph. Nothing more.
The problem I have right now is:
Every geometry is loaded into the origin (0,0,0). But I want to display them in a row.
Does anybody know how to do that? Where does a geometry starts and ends and how do I use that knowlege so that the next geometry is placed right next to the other one?

Help would be really appreciated!

getLocalTranslation() - local space position
getWorldTranslation() - global position (adding parent nodes positions)

getWorldBound() - casted for example to BoundingBox you can have extentX * 2 = width for example.

start position is getLocalTranslation()
end position is getLocalTranslation() + ((BoundingBox)getWorldBound()).getXExtent() * 2 → if bounding is boundingBox type. (and X is width, not Y or Z)

in GUINode, size 1 = 1 pixel.

Everything that extends Spatial (Node, Geometry, etc) will have a BoundingVolume - usually a BoundingBox - or for better explanation - an Axis Aligned Bounding Box (AABB).

BoundingBox bb = (BoundingBox)myThing.getWorldBound(); // .getModelBound() for Geometry
Vector3f extent = bb.getExtent(null);


The spatial’s AABB will probably work for this case.

In general, however, it’s not a reliable way to determine the size of a model. For one thing, it might not be the minimal AABB, particularly if the model is rotated. And for animated models, it’s usually calculated for the model’s “bind pose”; playing animations may cause a model to “poke out” of its AABB.

Thank you all!
I’ll try this! Hopefully I’ll achive something… ^^’

On a totally different note… Do you also happen to know, if I can move the internal coordinate system of a geometry? I mean, in a way that it is not in the centre of a geometry anymore?

Might be helpful:

Also helpful to do the tutorials.

The coordinate system of a Geometry is the one in which mesh vertices are positioned. So if the vertices are centered on some location other than (0,0,0), then the Mesh will be off-center with respect to that coordinate system.

However, it usually makes more sense to center the mesh vertices on (0,0,0) and use the geometry’s transform to position the Mesh where you want it using move() or setLocalTranslation(). This is much easier than modifying the Mesh.

Do you mean this?
You have your spatial,

It has bounding volume,

which has setCenter?

I don’t think you call setCenter on the bounding volume - I think there’s a .centre() method for spatial though.

He says wanted to set it other than center though.

Edit: Wouldnt something like this be what he needs? Using your example.

BoundingBox bb = (BoundingBox) myThing.getWorldBound();
bb.setCenter(x, y, z);

That won’t do anything but fool the scene graph into thinking the bounds is somewhere it isn’t. It will mess up culling but won’t actually MOVE anything.

This is a scene graph problem. If you want some object to be somewhere other than its own center then you add it to a node and move it relative to that node… then treat the node as the thing. I reference the scene graph docs again.

Right but he says it was for something else other than movement.

No idea why you would want to but doesn’t moving the center do just that?

Edit: Maybe he means origin. Not sure now.

Moving the bounds center just moves the bounds center. If you ask the bounds what it’s center is then it will lie to you. It affects absolutely nothing at all about the geometry. If you ask the geometry what it’s Mesh vertexes are then it will tell you the same thing it did before artificially moving the bounds center.

I can think of no other way to interpret “internal coordinate system” other than some kind of coordinate system… ie: where things are placed by coordinates.

Changing the center of the bounding shape will not affect that at all.

Hey there!

Thanks again for the help! Sorry for not replying sooner, but this is for a work project, meaning if I am not at work, I usually don’t check anything.
Which leads me to the problem: this was a project requirement. Like "We have a global coordiante system and a lot of local coordinate systems: I want to attach the geometries by their local cs, but they are not allowed to overlap. " I thought the local cs of a Geometry is alway in the centre of the Geometry and not moveable. Moveable in the sense, that it changes the possition inside the Geometry but not in the scene graph itself.
I didn’t even know if something like that was possible so I asked!
Thanks again for all the help! I think I found a solution! Although a little differently! (Project requirements change all the time after all!)

Unless I misunderstand what you are saying, you just described what a scene graph does. It’s just a hierarchy of local coordinate spaces each defined relative to the parent coordinate space. That’s it.