Create xyz on the screen

daripada gak da yang diposting..:P

private Text fps,X,Y,Z;
        Vector2f screenPosition = new Vector2f();
        Vector3f worldCoords = display.getWorldCoordinates(screenPosition, 0);

        float x1 = worldCoords.getX();
        float y1 = worldCoords.getY();
        float z1 = worldCoords.getZ();
        
        //parsing
        String getX1 = Float.toString(x1);
        String getY1 = Float.toString(y1);
        String getZ1 = Float.toString(z1);

        X.print("Sumbu X : " + getX1);
        Y.print("Sumbu Y : " + getY1);
        Z.print("Sumbu Z : " + getZ1);
        logger.info( worldCoords.toString() );
X = Text.createDefaultTextLabel("sumbu x","");
        X.setCullHint(Spatial.CullHint.Never);
        X.setTextureCombineMode(TextureCombineMode.Replace);
        X.setLocalTranslation(0, 20, 0);

        Y = Text.createDefaultTextLabel("sumbu y","");
        Y.setCullHint(Spatial.CullHint.Never);
        Y.setTextureCombineMode(TextureCombineMode.Replace);
        Y.setLocalTranslation(0, 40, 0);

        Z = Text.createDefaultTextLabel("sumbu z","");
        Z.setCullHint(Spatial.CullHint.Never);
        Z.setTextureCombineMode(TextureCombineMode.Replace);
        Z.setLocalTranslation(0, 60, 0);

        Nodes = new Node("node text");
        Nodes.attachChild(fps);
        Nodes.attachChild(X);
        Nodes.attachChild(Y);
        Nodes.attachChild(Z);
        Nodes.attachChild(mouse);
        Nodes.setRenderState(font);
        Nodes.setRenderState(as1);
        mouse.setRenderState(as1);
        Nodes.setCullHint(Spatial.CullHint.Never);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s