dat-ng / ar-location-based-android

This AR app generally show where things are in the real-world by indicating where the app thinks they are over the camera view when the user holds the phone up and moves it about.
MIT License
203 stars 85 forks source link

How to detect that ARObject pass from screen center #18

Closed ziselos closed 6 years ago

ziselos commented 6 years ago

Is there a way to detect if the center of screen passed from an ARObject? For example suppose we have an image in the center of screen and we want to detect when that image passed from the object.

dat-ng commented 6 years ago

Your idea is crosshair, right? you can put this image on screen with x = centerX - image.width/2 and y = centerY - image.height/2. If the coordinate of object is within range (x > centerX - image.width/2 && x < centerX + image.width/2 && y > centerY - image.height/2 && y < centerY + image.height/2), then you can change color or image of object based on canvas

2018-01-15 20:22 GMT+07:00 Zisis Dimitriadis notifications@github.com:

Is there a way to detect if the center of screen passed from an ARObject? For example suppose we have an image in the center of screen and we want to detect when that image passed from the object.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dat-ng/ar-location-based-android/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOmjHsLDQc4QWrorfhbhTBunKHrT-AXks5tK1EVgaJpZM4ReZ5i .

ziselos commented 6 years ago

For example i put a rectangle in the ar layout (center) and i would like when i move the mobile and the ar object placed into the area of the rectangle to change the color of object based on canvas. The rectangle is always in center of my screen (as i declared it in the layout)

ziselos commented 6 years ago

I tried your suggestion and works fine. Thanks a lot for your response.