Help with Arrows and Geometry rotations


I’m trying to debug a meteo system with the Arrow meshes (very usefull). At first, I created a thousand of different Arrow(direction) instances, but my FPS was then too low.

I’m trying to use the same Arrow object now for faster rendering. But I have troubles to give it the right orientation :cry:

[java]Arrow arrow = new Arrow( new Vector3f( 0f, ARROWLENGTH, 0f ) );


Geometry geo = new Geometry( null, arrow );

Vector3f targetArrow = new Vector3f( tx, ty, tz );

geo.lookAt( targetArrow, Vector3f.UNIT_Y );


The lookAt command doesn’t work the way I expect… Any idea ?

Thank you normen,

I gave a shoot at GeometryBatchFactory.optimize() … The result is a bit weird.

Before :


Okay found why, I guess it’s a small bug in the optimize function. It forget to reset the node or something.

Working :

[java] GeometryBatchFactory.optimize( meteoNode );

meteoNode.setLocalScale( new Vector3f( 20f, 2f, 20f ) );

meteoNode.move( new Vector3f( -2560, 0, -2560 ) );[/java]

Not working :

[java] meteoNode.setLocalScale( new Vector3f( 20f, 2f, 20f ) );

meteoNode.move( new Vector3f( -2560, 0, -2560 ) );

GeometryBatchFactory.optimize( meteoNode );[/java]

Thanks for the help, it’s much faster now ! :slight_smile:

Fixed it :


public static Node optimize(Node scene, boolean useLods) {


scene.setLocalScale( Vector3f.UNIT_XYZ );

scene.setLocalTranslation( Vector3f.ZERO );

scene.setLocalRotation( Quaternion.ZERO );

return scene;



Sorry but maybe I wasn’t clear (mixing my problems and something else) :

I think I found a bug in GeometryBatchFactory.optimize()

The fix, if I’m right, is right above. :slight_smile:

You’re probably right. For some reason normen thought it was appropriate to modify the argument geometry given in optimize() rather than a new one, but since optimize() automatically applies the world transform of all objects, then the original transform set on the node should be reset.

Fixed in SVN.

Superb, thank you ^.^