Start a new topic
Solved

Click on screen registered as click on model

Hi, 


I have an app where models appear as you walk around and you have to aim at them to destroy them. To do this I am using the workaround I found here on the forum where a tap/click on the middle of the screen is simulated programatically. 


https://support.wikitude.com/support/discussions/topics/5000079253


The problem is that the model's onclick method is triggered regardless of whether it is in the middle of the screen where the tap happens. Is there a way to fix this?


Best,

Filipe


The click event workaround does the exact same as if you click at the specific coordinate. I guess the bounding box of your 3D model is quite large which gives the impression that it fires without a reason. Please try using a wt3 file from the sample application and try manual clicks to verify.


Best regards

I figured out the problem, It wasn't the model rather I didn't have a couple of lines of code in my javascript for android 5.0 and up: 

clientX: centerX,

clientY: centerY


I didn't understand at first that this had to be in addition to screenX: centerX, screenY: centerY.


Best regards 

Login or Signup to post a comment