Start a new topic
Solved

Selecting a POI pointing with a crosshair

Selecting a POI pointing with a crosshair


Hi, I want to select POIs by "pointing" with an image in the middle of camera view (for example, with a crosshairs). The POI should be selected when the crosshair image collides with the POI drawable. Is there something I can use to detect collision?. If not, Is there a way to know the screen coordinates from a POI?. As far I know, there's a location (in the 3D virtual world) but I need to know the local view coordinates. 

 

Thank you very much.

 

: Title changed to better understanding of what I'm trying to do

This is not directly supported. However you might be able to get this behavior by simulating a click (either in JS, or native). From the top of my head I'm not sure if you can fake a click.

Following code is a hack and might not work in future version (... and is untested, but i'm sure you can make it work)

var event = {changedTouches: };

AR.js.click.executePlatformClick(event);

 

Basically the object "event" is the same as a touche event. The only required properties is the changedTouches array with 1 entry that has the touche location set. executePlatformClick is an internal function and executes a click at the certain location.

Again: this is not officially supported and might stop working in future SDK releases.

 

Looks promising. I'll give it a try. :D

Thank you Wolfgang.

Hi,

Thanks for the idea and I have one question here and hope someone can help.

1. How can we get the X and Y coordinate of the Animating AR object in the screen ?

 

Thanks a lot and hope ot hear from someone soon.

A function to get screen coordinates is currently not available in our API. However I'm interested in why you would benefit from this feature so we can better decide if we want to support it in the future. Additionally knowing the goal you are trying to achieve we might be able to find a way to accomplish the same thing, without getting the x,y screen coordinates.

Hi Wolfgang,

 

Can we know what function can we use to call the "fake a click" so that we can have the selecting the point with a crosshair.

 

Hope to hear from you asap. Thanks.

 

Regards,

Wei Jian

I would like to do the same stuff. Are there news about this topic?

This feature is still in ongoing discussion on our end and no final decision has been made. However you can have a look at the code and description I've posted as 1st reply to the initial question. This might already give you the possibility you are looking for.

I confirm you that your solution works like a charm but i'm worried about future compatibility.

I will release an important app (buying a pro license i guess) with your implementation but i would like to be comforted about a real implementation of crosshair-mechanism in the near future.

Let me know

Cheers

 

Hi,

any change to this of course won't have any impact on an already released application.

At the moment I don't have anything new to share with you on that topic, but I can assure you that there currently isn't any planned change that will be conflicting with the unsupported method.

Hello,

I have tried the below code in my ArchetrectWindow.js file, it seems to give error. i am using the wikitude sdk3.3.1 and titanium SDK 3.4.0.

I need to add a sign like cross hairs on the camera overlay to detact the image in 3D image recognization.

Please help

Thanx in Advance.

var event = {changedTouches: };

AR.js.click.executePlatformClick(event);

 

Hi Mahendra,

What Wolfgang wrote above is still true, the crosshair-feature is not officially supported in the SDK, but the code should work. Basically, you are passing the screen coordinates that have been clicked to the SDK.

To help you out, we need a proper description of what is going wrong with the code in your application.

Thanks,

Martin

Hi,

I am using wikitude 4.1 version. I am trying to implement the same scenario as asked in the first post.

I am not sure where to place this piece of code. In my scenario when camera ceter point focus on an image i should be able to 

display certain details.

var event = {changedTouches: };

AR.js.click.executePlatformClick(event);

 where am i suppose to put this code. Can you please guide me with this solution.

Thanks,

Manish

var clickScreenCenter = function clickScreenCenterFn() {
var centerX = ((window.innerWidth) / 2);
var centerY = ((window.innerHeight) / 2);
var event = {
changedTouches:
};
event.preventDefault = function() { /* Intentionally Left Blank */ };

if (AR && AR.js && AR.js.click && AR.js.click.executePlatformClick) {
AR.js.click.executePlatformClick(event);
}

setTimeout(clickScreenCenter, 1000);
}

clickScreenCenter();

 

 

Best regards

1 person likes this
Login or Signup to post a comment