[SOLVED] Positioning Quad problem

Hi all,

I’ve been banging my head against this issue for a while and for the love of God can’t find my mistake.

Basically I am trying to replace a cube with a billboard quad on the same position, but my quad always appears in the center. The cube of course is not in the center. Tried debugging, but getLocaltranslation on the cube returns always 0,0,0. It is a basic mistake, I’m sure, but I can’t see it.

My nodes hierarchy:


levelRoot = new Node(ROOT_NAME);//atached to root node

//root node of all quads

openedUnits = new Node(OPENED_NAME);


//To make numbers always look at the camera

BillboardControl control = new BillboardControl();


//Put it in the transparent bucket


//root node of cubes

remainingUnits = new Node(REMAINING_NAME);



How I construct the cubes at first:


private void loadLevel()


//TODO load units in positions

for (int x = -1; x <= 1; x++)


for(int y = -1; y <= 1; y++)


for (int z = -1; z <= 1; z++)


Geometry g = createCube(x, y, z);






private Geometry createCube(int x, int y, int z)


String indexAsName = generateIndex(x, y, z);

Vector3f center = new Vector3f(x, y, z);

Box b = new Box(center, sideHalfSize, sideHalfSize, sideHalfSize);

//TODO how to clone geometry? or shape

Geometry geom = new Geometry(indexAsName, b);


return geom;



Now I try to replace a cube with a billboard quad, locating the quad on the same position:


private void openRegularUnit(Geometry unit)


Quad q = new Quad(2sideHalfSize, 2sideHalfSize);//My billboard quad

Geometry g = new Geometry(“1”, q);

g.setMaterial(digits[0]);//set transparent texture

openedUnits.attachChild(g);//Attach to root node of all quads, should be at 0,0,0

//position quad so center of quad is like center of cube

Vector3f pos = unit.getLocalTranslation().add(-sideHalfSize, -sideHalfSize, -sideHalfSize);

//put quad in the same place - does not work !!


//remove cube




Of course, thing don’t work as I expect, the quad appears in the center at 0,0,0

Full source if you want it. The problematic code is in the Level.java:


Help, please :frowning:

Shouldn’t it be getworldtranslation at line 09?

Your creating your box mesh at an offset, so its localTranslation is always (0, 0, 0); Try this inside your createCube() function


Box b = new Box(new Vector3f(0, 0, 0), sideHalfSize, sideHalfSize, sideHalfSize);

Geometry geom = new Geometry(indexAsName, b);



1 Like

Yes, thank you wezrule. Indeed that fixed it.