How to I use ofCamera::screenToWorld to calculate positon on a plane

I have a plane in 3d space. Every time a user clicks, I want to map the mouse location to a location on the plane, and then draw a sphere in that location. Help?

You need to do a ray-plane intersection

screenToWorld will give you points on your pick ray

And then use intersection maths to see where the ray and plane coincide

You could use ofxRay for this

Thanks for anyone else wondering this is how I mapped screen positions to a position on a x-z plane;

    ofVec3f screenToWorld = cam.screenToWorld(ofVec3f(ofGetMouseX(),ofGetMouseY(),0.0));
    ofxRay::Ray ray(cam.getPosition(),screenToWorld - cam.getPosition());
    ofxRay::Plane plane(ofVec3f(0,0,0),ofVec3f(0,1,0));
    ofVec3f pointOnPlane;
    ofLog() << pointOnPlane;