Hi,
I am trying to write text on the screen that will always face the viewpoint.
I've put the geometry object from a Text2D object within an OrientedShape3D
object. The only problem is that the text does not show up anywhere near the
point I specify in the creation of the geometry object. What am I doing
wrong? Here is some code that i similar to the code I use. Why doesn't
"shape" and "oshape" appear near each other when rotating the scene (using
OrbitBehavior on my ViewingPlatform)? If anyone have any ideas, please let
me know.
//begin ---
BranchGroup sceneRoot = new BranchGroup();
//try any point except 0,0,0
Point3f txtPoint = new Point3f(1.0f,0.0f,0.0f);
Text2D txt2d = new Text2D("12345", new Color3f(0.0f,0.0f,0.0f),
"Helvetica", 10, Font.PLAIN);
Shape3D shape = new Shape3D(txt2d.getGeometry());
shape.setAppearance(txt2d.getAppearance());
txt2d = new Text2D("12345", new Color3f(0.0f,0.0f,0.0f),
"Helvetica", 10, Font.PLAIN);
OrientedShape3D oshape = new OrientedShape3D();
oshape.setGeometry(txt2d.getGeometry());
oshape.setAppearance(txt2d.getAppearance());
oshape.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT);
oshape.setRotationPoint(txtPoint);
TransformGroup tg = new TransformGroup();
Transform3D tf = new Transform3D();
tf.setTranslation(new Vector3d(txtPoint));
tg.setTransform(tf);
tg.addChild(shape);
tg.addChild(oshape);
sceneRoot.addChild(tg);
//end ---
Anders
----------------------------------------------------------
Anders Hasselkvist Tel:+46 8 412 95 00
COMSOL AB Fax:+46 8 412 95 10
Tegn�rgatan 23
S-111 40 Stockholm mailto:[EMAIL PROTECTED]
SWEDEN http://www.comsol.se
----------------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".