"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Collision of 2 images

I have a 2 similar teapot image for 2 different targets. If these targets are kept very near such that both of them can be focused from mobile camera screen at the same and the both of these targets renders 2 teapots, I get 2 similar teapots at a time overlapping each other.

Can I in some way find that if a teapot is being overlapped by another teapot programmatically ?

 

Thanks.

Hi nrgarach

It sounds like your question is "how can I check if two teapots collide?"

If so, then you might need to implement some kind of basic box collision for 3D objects - the kind of thing that you get for free with Unity.

DavidBeard

Tue, 08/28/2012 - 16:04

You should be able to do this by comparing the pose matrices of the respective Trackables. If the models are offset from the origin of their parent target, these offsets will need to be taken into account.

Thank you for your reply.

Should I compare the pose matrix(3x3 sub-matrix in left 3 columns) in

 SampleUtils::translatePoseMatrix(float x, float y, float z, float* matrix)  for each of teapots ?

DavidBeard

Wed, 08/29/2012 - 21:43

How are you obtaining the pose matrix?

getPose() is going to return a 3x4 matrix and you'll want to use the right most column (i.e. indices 3, 7, 11 ), which will give you the x,y,z coordinates relative to the camera position - the camera is 0,0,0.

e.g.

I am using 

QCAR::Matrix34F poseMatrix = trackable->getPose();

 Is this correct ? If yes, with what should I compare my indices 3,7,11 of poseMatrix to find if the teapot intersects with another one ?

Also, I have 

// Get the trackable: