Ok, so I did this:
/***
* Create any nodes needed for the game.
* @throws java.lang.Exception
*/
public void initNodes() throws Exception{
//generate quad bounding boxes
sector.createQuadBoundingBoxes(pickingQuads,
assetManager);
rootNode.attachChild(pickingQuads);
rootNode.attachChild(liveQuads);
//pickingEffects.attachChild(GameShapes.createPickingOutline(assetManager));
//rootNode.attachChild(pickingEffects);
//Picking.pickingEffects.attachChild(GameShapes.createPickingOutline(assetManager));
//rootNode.attachChild(Picking.pickingEffects);
outline = GameShapes.createPickingOutline(assetManager);
Picking.pickingEffects.attachChild(outline);
rootNode.attachChild(Picking.pickingEffects);
//rootNode.attachChild(outline);
System.out.println("translation:" + outline.getWorldTranslation());
System.out.println("Rotation:" + outline.getWorldRotation());
System.out.println("Bound:" + outline.getWorldBound());
//rootNode.attachChild(GameShapes.createPickingOutline(assetManager));
}
The output is:
translation:(0.0, 0.0, 0.0)
Rotation:(0.0, 0.0, 0.0, 1.0)
Bound:BoundingBox [Center: (0.0, 0.0, 0.0) xExtent: 0.0 yExtent: 0.0 zExtent: 0.0]
At this point the mesh is empty though. On the click event I do:
int lineCount ;
lineCount = 1; //one line for now
float[] tpa = new float[6 * ( lineCount )];//position array
short[] ibarrayTemp = new short[ 2 * ( lineCount ) ];//index array
//add in the vertices (key is the Vector3f rep centre of quad)
//This draws a big line straight up.
tpa[0] = key.x;
tpa[1] = key.y;
tpa[2] = key.z;
tpa[3] = key.x + 1;
tpa[4] = key.y + 50;
tpa[5] = key.z;
//add in the idx's
ibarrayTemp[0] = (short)0;
ibarrayTemp[1] = (short)1;
//load up the data
pickOutline.setBuffer(VertexBuffer.Type.Index, 1, BufferUtils.createShortBuffer(ibarrayTemp));
pickOutline.setBuffer(VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer(tpa));
System.out.println("translation:" + outline.getWorldTranslation());
System.out.println("Rotation:" + outline.getWorldRotation());
System.out.println("Bound:" + outline.getWorldBound());
Which also gives me:
translation:(0.0, 0.0, 0.0)
Rotation:(0.0, 0.0, 0.0, 1.0)
Bound:BoundingBox [Center: (0.0, 0.0, 0.0) xExtent: 0.0 yExtent: 0.0 zExtent: 0.0]
Should I be initializing the mesh with data when the Geometry is first created? It just seems that there is no difference with what I am doing between adding the Spatial directly to the rootNode and adding the Spatial to a child node and adding the childnode to the rootnode.
On the working code I did try to remove
geom.setCullHint(Spatial.CullHint.Never);
and that did break it. The line no longer drew.