How to draw a coordinate plane?

hi folks,



is there any already written class to draw a coordinate plane in which i can place some pillars to show something like a statistic? or do i have to draw it by myself using trimesh? i could find a class coordinate space but maybe you know if there is



thanks

what do u mean with "coordinate plane" ?

A plane with a grid and maybe some indicators for the x/y/z values?

As far as i know there is no such class, at least not in the core of jme.



And for drawing some pillars into it, u'll have to use cylinders, boxes or quads if u want them in 3D space.

U might draw them in Orthomode as well.



Quick Approach:


package test;

import com.jme.app.SimpleGame;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.shape.Cylinder;
import com.jme.scene.shape.Quad;

public class TestDrawDiagramm extends SimpleGame {

/**
* @param args
*/
public static void main(String[] args) {
TestDrawDiagramm app = new TestDrawDiagramm();
app.start();
}

@Override
protected void simpleInitGame() {
setupCam_n_Input();
setupCoordinateLines();
setupStats();

}

private void setupStats() {
Cylinder stat1 = new Cylinder("stat1",5,5,0.5f,6);
stat1.lookAt(Vector3f.UNIT_Y, Vector3f.UNIT_Z);
stat1.setLocalTranslation(-4,3,0);
rootNode.attachChild(stat1);
}

private void setupCoordinateLines() {
float thickness, height;
for(int i=-10; i<=10; i++){
if(i==0){
thickness = 0.1f;
height = 25;
}else{
thickness = 0.05f;
height = 20;
}
Quad xQuad = new Quad("x".concat(Integer.toString(i)), thickness,height);
xQuad.setLocalTranslation(Vector3f.UNIT_X.mult(i));
rootNode.attachChild(xQuad);

Quad yQuad = new Quad("y".concat(Integer.toString(i)), thickness,height);
yQuad.setLocalTranslation(Vector3f.UNIT_Y.mult(i));
yQuad.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.PI/2, Vector3f.UNIT_Z));
rootNode.attachChild(yQuad);
}
}

private void setupCam_n_Input() {
cam.setLocation(new Vector3f(0,0,-20));
cam.setLeft(Vector3f.UNIT_X);
cam.setUp(Vector3f.UNIT_Y);
cam.setDirection(Vector3f.UNIT_Z);

input.getFromAttachedHandlers(0).setEnabled(false);
}

}
what do u mean with "coordinate plane" ?
A plane with a grid and maybe some indicators for the x/y/z values?


yes exactly

and then i want to put some pillars into it. the pillars i have already created on my own by making a nem trimesh.

You may want to look at the RenParticleEditor, it has a nice function that creates a grid geometry object that you could probably use.

ok thx i will search for it.



just to mention: i want to draw a 3D coordinate plane.

i can't find RenParticleEditor anywhere… where do i have to look at?

package jmetest.effects



and btw: a plane is 2D :wink:

and btw btw: a 3D coordinateGrid will be confusing, pretty sure. (depending on its resolution)

yes i meant a grid :wink: sry for that



i dont think its too confusing… it should be something like AxisRods() but a little bit more sexier and whit grids :smiley:



now i tried to draw a cuboid to show the space of the coordinategrid. but unfortunately i can't make it transparent… :S

You could probably just use long, thin quads attached to the HUD Node.