Start a new topic
Solved

Get coordinates of AR model

Hi,

I am writing a shooter game in JavaScript API 7.0 on Android, and in this game I have some models (soldiers) and a gun scope on the screen which always has center in the screen's center.
Is there a good way to check whether I "killed" a soldier when I pressed fire button? I mean that want to check if the scope was directed to some of soldiers or not when i fired.
I tried to use something like this:

   

// get XY of screen center
var xCenter = window.innerWidth / 2;
var yCenter = window.innerHeight / 2;

//convert XY to point cloud coordinate and then compare with tgranslate coords of soldier
World.instantTrackable.convertScreenCoordinateToPointCloudCoordinate(xCenter, yCenter, function(x, y, z) {.....here I check if converted coordinated are similar to the soldldier's translate values.......}

  But it's not always gives me a result.

Is there a better whey to do this?

Thanks in advance! 


Hi Alex,

Is there any way to make smth similar in 
Wikitude JS SDK without using Unity plugin?
Or is there any possibility that this feature will be availabe soon in newer releases?

Edward

Hi Eduard,


currently there is no hit-test api for drawables. 

Please note that the Wikitude JS SDK is not optimized for advanced games. 

For this use-case we have a Unity plugin which you could use.


Best Regards,

Alex

Hi Eva,

JS API
SDK ver 7.0.0
I don't using any extensions

Hello Eduard,

Could you please first provide some further details:
  • Which version of the SDK are you using?
  • Are you using the JS API?
  • Are you using any of our Extensions (Titanium, Cordova, Xamarin, Unity)? If yes, which version are you using?

Thanks

Eva

 

Login or Signup to post a comment