SimpleJMEApplet AbsoluteMouse Y axis inverted

Hello, I am working with SimpleJMEApplet and following the HelloMousePick tutorial. everything works, but when I move the system mouse up, the JME cursor goes down… (Y axis is inverted)

I tried with InputHandler instead of FirstPersonInputHandler, with the same result.

I think it could be something relative to differences between AWT and JME screen coordinate system, but I can

Hi Milo,

I've the same problem (inversion Y-axes in canvas).

Have you solved this problem?


Have you tried the applets in jmetest.awt.applet?

I renanse,

I’m working with JMESwingTest,

After having loaded a simple file “.obj” into canvas (a simple cube with 3 textures),

I want change the textures when I pick into faces.

Following the HelloMousePick, I have success bat… the Y-axis in canvas is inverted, why?

I want to explain

1- the obj files was loaded

2- with mouse I click above the cube, but I see the target points below…

3- I drowed the ray-lines and… all there are below the cube

The X and the Z axis work correctly, but Y are inverted.

Any solution?

Ok, so if I understand correctly, your mouse control is ok (like dragging and such) just the pick ray is bad?  Can you send me your test?  (email is <—)

renanse said:

your mouse control is ok (like dragging and such) just the pick ray is bad?

no, also the mouse control is bad.
Zoom, rotation, translation camera work correctly, bat the picking no.
the pick result follow the inverted axis as the traced ray.

I prepare a little example (now I'm in pre-pre-pre-pre-alpha testing...) and I'll send to you.

thanks in advance  :)

Hi Renanse,

I've sended you my little example…  :wink:

Hi all,

I've resolved.  :smiley:

thanks anyway :wink:

Glad it's working for you now.  If there is any advice you can give to others to help them avoid a similar issue in the future, please do!

Hi all,

I've solved the problem of inversion of Y-axis.

Simply I've substract the dimension of local canvas from Y

The code is like this:

float xScreen = MouseInput.get().getXAbsolute();
float yScreen = DisplaySystem.getDisplaySystem().getHeight() - MouseInput.get().getYAbsolute();

Vector2f screenPos = new Vector2f(xScreen,yScreen);
Vector3f worldCoordsStart = DisplaySystem.getDisplaySystem().getWorldCoordinates(screenPos, 0);
Vector3f worldCoordsEnd = DisplaySystem.getDisplaySystem().getWorldCoordinates(screenPos, 1);
Vector3f startPoint = worldCoordsStart;
Vector3f endPoint = worldCoordsEnd.subtractLocal(worldCoordsStart).normalizeLocal();

Ray rayLine = new Ray(startPoint, endPoint);
PickResults results = new TrianglePickResults();


I's work fine, the object's picking is correct.  :D