HectorGitHub23 / droidar

Automatically exported from code.google.com/p/droidar
0 stars 0 forks source link

Removing drawn MeshComponent #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Can I remove drawn MeshComponent when marker is not visible and then set it 
again? How can I do that?

Original issue reported on code.google.com by k.kar...@mobilefactory.com on 1 Jul 2011 at 11:26

GoogleCodeExporter commented 8 years ago
The way i would do that, would be to create a subclass of Component which 
checks if the marker was visible the last x ms. This could be done by setting a 
flag in the Component to true every time the marker is detected and the 
Component will set it to false after x ms via the update method.

Original comment by simon.heinen on 1 Jul 2011 at 1:38

GoogleCodeExporter commented 8 years ago
Ok, so, which method checks if the marker was detected? In main loop in 
DetectionThread is called method nativelib.detectMarkers(frame, mat, 
frameHeight, frameWidth,false), but it returns something else.

Original comment by k.kar...@mobilefactory.com on 1 Jul 2011 at 1:52

GoogleCodeExporter commented 8 years ago
Just extend a MarkerDetectionSetup like in the MarkerDemos project and register 
a callback listener like the CameraMarker or the VirtualObjectMarker class in 
the _a3_registerMarkerObjects method. If you need to display something on the 
marker take a closer look at the VirtualObjectMarker. I would recommend to use 
this one and create a subclass to additionally set the detection flag to true 
every time the marker is recognized. first understand what happens in the 2 
setups in the MarkerDemos project, then it should be easy to start

Original comment by simon.heinen on 4 Jul 2011 at 6:35

GoogleCodeExporter commented 8 years ago
Thanks, it works! One more question, where can I get position of drawn 
MeshComponent?

Original comment by k.kar...@mobilefactory.com on 20 Jul 2011 at 2:39

GoogleCodeExporter commented 8 years ago
Ok it depends now which setup you are using;) if you are moving the camera with 
the marker around you can just place any objects wherever you want around the 0 
vector. If you use the marker to calculate the position in relation to the 
virtual camera (by using the VirtualObjectMarker) then i would recommend to 
change the mesh to a MeshGroup object and put meshes inside it. Then you would 
be able to move the meshes inside the marker coordinate system (so the 0 vector 
would be the center of the marker and all the meshes inside the mesh-group will 
have their local coordinate system). Then just do something like this: 
subMesh.myPosition=new Vec(0,0,2) to let the sub-mesh fly above the marker

Original comment by simon.heinen on 20 Jul 2011 at 11:35