PDA

View Full Version : Distance to object in world space



silvio
08-23-2011, 06:21 AM
Hi all,

I was wondering if someone could help me out.

I am currently doing a project using nyartoolkit ( Augmented reality ) and Java. I have altered the code so I can place multiple objects on one marker.

So far so good and everything works fine.

The problem arises when I need to know the coordinates for my extra object(s) ( e.g. I need to know if the object is in a certain range of the screen ). I know the position of the marker in world space but the extra object only gives me back the initial coordinates. ( when the marker was at 0,0,0 the additional object was at -3, 1, 2 ( theoretically ) )


What I need to know now is when my marker is at ( 20, 2, 30 ) how do I calculate where my additional object is?

I hope the above is clear enough, if it isn't please let me know.

Thanks,

Silvio.

BionicBytes
08-23-2011, 09:20 AM
extra object only gives me back the initial coordinatesWhat does that mean? Is this a world space coordinate?

I don't follow how you can not know the coordinates of your objects which you are drawing or placing in the world. If you have two world space verticies, then subtracting the two gives a direction vector (when normalised). The length of this tells you how far apart they are.