About Plane, Point, Intersection and objects facing the camera


I'm currently trying to move some objects so that they will all belong to a same plane.

I've got the normal vector of the plane (camera.getDirction()) and I've got the position of the objects.

How can I determine the new position of my object, a point in space which will belong to a plane?

Yes, I'm trying to make some objects face the camera (maybe explained this way my question will be more understandable).  :slight_smile:

Thanks for your answer!


After some research, during which I found this cool applet:

Equation for a plane: a*x+b*y+c*z+d=0 what those coefficients (a,b,c,d) means

I came with the following solution:

1/ create a Plane object using

Plane p = new Plane(camera.getDirection().mult(-1), planOrigin.clone());

2/ Loop over all objects to move and find the point on the plane where they will intersect if moved along the camera.getDirection() vector:

Ray r = new Ray(objectToMove.getWorldTranslation().clone(),camera.getDirection());
Vector3f where = new Vector3f();

// manage wrong direction because of object position
if( where.equals(Vector3f.ZERO) ) {

Now where Vector3f will contain the position in space where the object should be moved (using a SpatialTransformer for example).

Hope that helps!