Page 1 of 1

CCVector3 result from the ItemPicked signal

Posted: Tue Mar 21, 2017 11:24 am
by vinayan
hi Daniel,

I used this event to get the x,y,z location of a point that I picked on a point cloud. My assumption was this CCVector3 gives me the x,y and z location of the point closest to my picking location. But is it instead giving the location of the clicked position on the screen?

Code: Select all

 SIGNAL(itemPicked(ccHObject*, unsigned, int, int, const CCVector3&)
So would using the below method be safe to get nearest point in the cloud?

Code: Select all

bool pointPicking(	const CCVector2d& clickPos,
						const ccGLCameraParameters& camera,
						int& nearestPointIndex,
						double& nearestSquareDist,
						double pickWidth = 2.0,
						double pickHeight = 2.0,
						bool autoComputeOctree = false);

Re: CCVector3 result from the ItemPicked signal

Posted: Tue Mar 21, 2017 6:31 pm
by daniel
If the 3D view is in 'point picking' mode (or 'point or triangle picking' mode), then the itemPicked signal will effectively be the nearest 3D point (or the point on the nearest 3D triangle).

By the way to do this, you can now use the new 'ccPickingHub' interface (but it depends on how you are trying to do it exactly).