Ray casting gives strange results

well thnx every 1 seems,i missunderstood function of this method,soo there is no any way or in game method,i can use to put

Vector3f start = new Vector3f(
player.getWorldTranslation());
}

Vector3f end = new Vector3f(
geomDir.getWorldTranslation());
}

and get every thing inside the ray that appears? like From----> To ?
well :smiley: exept creating it my self?i’ve actually allready made 1 ,but its not precise,and say if its in or out ,but no exact collision point …

http://javadoc.jmonkeyengine.org/com/jme3/math/Ray.html#setLimit-float-

And I’m probably wasting my time… but:

Vector3f start = player.getWorldTranslation();
Vector3f end = geomDir.getWorldTranslation();
Vector3f delta = end.subtract(start);
Vector3f dir = delta.normalize();
float length = delta.length();

Ray ray = new Ray(start, dir);
ray.setLimit(length);

well sorry for making you wasting time :slight_smile: ,but i’m actually having some good help of it soo thnx :smiley:

The way you’d want to do this would most likely depend on your specific case, but i’d suggest starting by attaching all of your collision geometries to the same node (or get the parent node for the active scene if your using a scene loaded from the scene composer) and then collide with the parent node instead of one specific gemoetry. Then you can loop through the CollisionResults array to find all of the geometries your ray collided with.