Start a new topic
Solved

Selecting a POI pointing with a crosshair

Selecting a POI pointing with a crosshair

Found the fix on this discussion : https://support.wikitude.com/support/discussions/topics/5000081081

A correct syntax to have it work on Android as well would be 


        var event = {

            changedTouches: 

            [

                {

                    screenX: X,

                    screenY: Y,

                    clientX: X,

                    clientY: Y

                }

            ]

        };


1 person likes this

Hi Gabriel,

thx for sharing your solution! Hopefully it helps others.


Best regards,

Andreas Schacherbauer


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

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

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.

Hi Andreas,


Is this workaround still working with SDK 8.5 ? 

I can't figure out how to have it work on my side, especially the 

var event = {changedTouches: };

which doesn't look like a correct JSON object.


If this is not available anymore, is there a way to simulate a click at a specific location on the screen? I'd like to place an AR.Model in my InstantTracker World at the position corresponding to the lower-left corner of my screen, when triggering a specific javascript function.


Thanks,

Gabriel


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

 

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
Login or Signup to post a comment