When rotating 3DText it goes wrong?

When I create 3DText and rotate it around the y axis, it all goes wrong. Or I understood something wrong about how 3D Text is supposed to work?



Here is what I do:



Font3D myfont = new Font3D(new Font("Arial", Font.PLAIN, 2), 0.1, true, true, true);

int angles = 0;

for ( int i = 0 ; i < 4 ; i++ )

{

  for ( int j = 0 ; j < 4 ; j++ )

  {

    Text3D myText = myfont.createText(i+","+j, 6f, 0);

    myText.alignCenter();

    ColorRGBA fontcolor = new ColorRGBA(1f, 0.8f, 0.8f, 1f);

    myText.setFontColor(fontcolor);

    myText.setLocalTranslation(new Vector3f(-1i5,-1j5,0));

    myText.setLocalScale(new Vector3f(3f,3f,0.1f));

    myText.setLocalRotation(new Quaternion().fromAngles(0,(float)Math.toRadians(angles), 0));

    rootNode.attachChild(myText);

    angles+=10;

}

}



The result is that the more the number pairs are rotated around the y axis, the closer they stand to each other. This is because apparently instead of rotating the entire string, it rotates each character individually and then, because they are now much thinner, they stand closer to each other. See also screenshot (before it disappears again?).



This is in jme 2 (the stable release downloadable right now).

Ok, through further trial and error I found out that this happens only when and if I set the localScale to some small z value. If z is set to similar values like x and y, then this doesn't happen:



myText.setLocalScale(new Vector3f(3f,3f,3f));



looks fine, whereas



myText.setLocalScale(new Vector3f(3f,3f,1f));



looks broken.



I believe this must be some bug in 3DText which computes the spacing between the glyphs by means of the unrotated bounding box of the glyph or something like that. Has this been fixed in the jme3?

oh, and while I am at it, another bug is that Text3D.alignCenter()



should look like this:



public void alignCenter() {

        getLocalTranslation().x -= width / 2;

        updateWorldVectors();

    }



and not like this:



public void alignCenter() {

        getLocalTranslation().x = -width / 2;

        updateWorldVectors();

    }



The minus in the wrong place mistplaces all text to the really wrong place, instead of really just aligning the text where it is at that moment.



If someone could commit that, it would be appreciated.

… and another bug is that setting a material state make all text look white, even though a light state was set with a few lights (and other objects with that same material state look nicely lighted). I have no idea how to fix that though, sorry.