Start a new topic

Start camera, Cordova plugin

Hi.. I am a beginner with wikitude.

I need to start the camera, how can I do it?


Hello Luis,

Please note that we do not support .gif files.

Thanks
Eva

 

Now, I can turn on the cammera, but when I write the code from the video that you refer me, the image never appears, this is my code:

 

<script>
        loaded = false;
        function locationChanged(lat, lon, alt, acc) {
            if (!loaded) {
                var marker_image = new AR.ImageResource("elviolin.gif");
                var marker_loc = new AR.GeoLocation(lat + 0.05, lon, alt);
                var marker_drawable = new AR.ImageDrawable(marker_image, 8);
                var marker_object = new AR.GeoObject(marker_loc, {
                    drawables: {
                        cam: [marker_drawable]
                    }
                });
                loaded = true;
            }
        }
        AR.context.onLocationChanged = locationChanged;
    </script>

 

<script>
        loaded = false;
        function locationChanged(lat, lon, alt, acc) {
            if (!loaded) {
                var marker_image = new AR.ImageResource("elviolin.gif");
                var marker_loc = new AR.GeoLocation(lat + 0.05, lon, alt);
                var marker_drawable = new AR.ImageDrawable(marker_image, 8);
                var marker_object = new AR.GeoObject(marker_loc, {
                    drawables: {
                        cam: [marker_drawable]
                    }
                });
                loaded = true;
            }
        }
        AR.context.onLocationChanged = locationChanged;
    </script>

  

Hello Luis,

What I suggest you do is, before you start coding, you have a look at our documentation in order to understand how it works. You should also download our samples and test them so that you can have a better understanding.

Since you want to build something similar like Pokemon Go then you can also refer to this blog post.

Thanks
Eva

 

Hi Eva, Thanks for help me. I need to do something similar like Pokemon Go, when a pokemon appears. I mean the next:

1. Start the camera.

2. Put an image in the center of the device screen.

3. When I move the camera, the image should be apper or disappear, depending on the movement.

I try to use ezar, an other technologies, but I can not do it. So, I'm trying using wikitude.

Hello Luis,

I am sorry but I do not exactly understand what do you mean by saying 'start the camera'. If you open any of our samples, the camera does not start? Could you please send more details regarding your issue?

Thanks
Eva

 

Login or Signup to post a comment