Hey everybody,
testinig my application on win7 and linux >> works fine.
Now I had the possibiliy to check it on Mac.
The test run on:
MAC OS: Yosomite
CPU: 2x2.8GHz Quadcore
GPU: NVidia 8800GT 512MB
RAM: 16GB
Display: 27Zoll FULLHD 1920x1080 Monitor
Java: 8u25
The collision detection on windows and linux works fine, but here it sucks
Clicking on Screen and check the collision on my sceneModel and return the collision point.
For this collision point I create later a sphere on model.
Here is the code of my collisions method:
private Vector3f getCollisionPoint() {
Vector3f v = new Vector3f();
CollisionResults results = new CollisionResults();
// Convert screen click to 3d position
Vector2f click2d = inputManager.getCursorPosition();
mx = inputManager.getCursorPosition().getX();
my = inputManager.getCursorPosition().getY();
Vector3f click3d = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 0f).clone();
Vector3f dir = cam.getWorldCoordinates(new Vector2f(click2d.x, click2d.y), 1f).subtractLocal(click3d).normalizeLocal();
// Aim the ray from the clicked spot forwards.
Ray ray = new Ray(click3d, dir);
// Collect intersections between ray and all nodes in results markerList.
sceneModel.collideWith(ray, results);
// (Print the results so we see what is going on:)
for (int i = 0; i < results.size(); i++) {
// (For each "hit", we know distance, impact point, geometry.)
float dist = results.getCollision(i).getDistance();
Vector3f pt = results.getCollision(i).getContactPoint();
System.out.println("Distanz: " + dist + "PT: " + pt);
String target = results.getCollision(i).getGeometry().getName();
System.out.println("Selection #" + i + ": " + target + " at " + pt + ", " + dist + " WU away.");
}
if (results.size() > 0) {
// The closest collision point is what was truly hit:
CollisionResult closest = results.getClosestCollision();
v = sceneNode.worldToLocal(closest.getContactPoint(), v);
hit = true;
} else {
hit = false;
}
return v;
}
On Mac:
If I set this sphere at this point in scene it appears (with offset) above the cursor.
This offset will be become smaler with “zoom in” by the default flyCam use.
I have no idea why I find this this behavior only on mac?
Is there some os spezific thing I have to check? Or can I try something to get the problem delimit?
On windodws 7 and linux it works fine without strange behaviors.
Has anyone an idea?
For advice I would be very grateful.
EsKay :3
Mabey @zzuegg ? Seem so you had a similar problem earlier …
http://hub.jmonkeyengine.org/t/mouseinput-on-osx-has-an-offset
Do you had found the reason or a solution? :}