Start a new topic

3D model not showing in GPS sample

3D model not showing in GPS sample


I'm trying to get a sample working of displaying a 3D model to display, at a certain GPS location. I have modified the sample from the site and either nothing shows or the Wikitude app just crashes for me. This is pretty much the meat of sample.

 

 AR.context.onLocationChanged = function (lat, lon, alt, acc) {
        // the current location's latitude, longitude, altitude and accuracy
        // are passed in by the ARchitect

        // Create a new RelativeLocation 10 meters north of the current location.
        // RelativeLocations allow you to place objects relative to others.
        // In our case, relative to the current user location.
        var myGeoLocation = new AR.RelativeLocation(null, 10, 0, 0);

        // Create an orange circle with a radius of 5
        var myCircle = new AR.Circle(1, { style: { fillColor: '#FFC100'} });

        // Create the GeoObject that puts it all together.
        // The GeoObject will be placed at the previously created GeoLocation and an orange Circle
        // will appear at that location. By creating the object it will be immediately visible.

        var model = new AR.Model("models/barrel.wt3", { enabled: true, onLoaded: function () { alert('loaded'); } });


        var myGeoObject = new AR.GeoObject(myGeoLocation, { drawables: { cam: model} });
        //AR.context.onLocationChanged = null;
        // Hide loading message
        document.getElementById("messageElement").style.display = "none";
    }



 

i'm new the 3D modeling so, it could be the model, so i have attched that. If it's that can you tell me what is wrong with it?

 

Thanks,

David

Are you testing this with Wikitude on iOS? If so you might have run into a bug that is in this released version. It is alreadt fixed in the SDK, so you can test it with the SDK.

A fix for it is scheduled for the next update of the Wikitude World Browser App.

would i test this by using Phone Gap and the SDK?

sure, the phonegap plugin from github works with the SDK 2.0 and would allow you testing this.

Hello,

I like to place an 3D-object on a GPS-position, too. Where can I find the tutorial. I only found the tutorials for "3D Assets Workflow" and "Working with 3D Animations".

 

And my next question is, if it is working with html&css on a Android 4.1.x device? Or do I need to develop a native or hybrid app?

Hi Guys,

My 3D models show up using relative location, but not GPS. I've set the lat/long to my office right where I am sitting. I also created an action area with 500 meter radius. 


What am I doing wrong? 


  

var stageLocation = new AR.GeoLocation(25.784146, -80.191038);
 var actionRange = new AR.ActionRange(stageLocation, 500);

//cake model
        this.cake = new AR.Model("assets/cake(6).wt3", {
            scale: {
                x: 1000,
                y: 1000,
                z: 1000
            },
            rotate: {
                x: 45,
                y: 30,
                z: 0
            },
            translate: {
                x: -12000,
                y: -12000,
                z: 0
            },
            enabled: true,
            //onLoaded: function () { }
        });

//geo object
        var geoObject = new AR.GeoObject(stageLocation, {
            drawables: {
                cam: [this.cake]
            }
        })

  



BTW, I'm using Xamarin PCL iOS / Android. 


Aside from my project, I'm testing using the sample iOS Xamarin project called WikitudeSDKExample.


I loaded up the x_Demo_1_2dTrackingAndGeo sample (That's the only one I see that uses Lat & Long - the others use relative locations). 


The problem is that sample has errors in the ADE.js

Uncaught TypeError: Cannot read property 'createTargetCollectionResource' of undefined
    at Object.__executeFunctionByName (file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/ade.js:1:297683)
    at Object.callAsync (file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/ade.js:1:297485)
    at c.init (file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/ade.js:1:166797)
    at c.(anonymous function) [as init] (file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/ade.js:1:4857)
    at new c (file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/ade.js:1:4720)
    at Object.IrAndGeo.initIr (file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/x_Demo_1_2dTrackingAndGeo/js/2dtrackingandgeo.js:127:37)
    at file:///C:/Users/spinteractive/Desktop/SpinDev/Dev/BayFest/App/App/Wikitude/all%20samples/x_Demo_1_2dTrackingAndGeo/js/2dtrackingandgeo.js:210:10

 

At this point, I don't have a working GEO sample with lat/long location.


Also, I have enabled location in my plist. 

	<key>UIBackgroundModes</key>
	<array>
		<string>location</string>
	</array>

 

Any ideas?

Hello Alexandre,

We will further investigate why the sample Demo_1_2dTrackingAndGeo is giving you errors in the ADE.js. In the meantime, you can refer to the documentation here in order to see how to use RelativeLocation class and also to this forum post to see if this helps.

Thanks
Eva

 

Hello Eva,

I understand how to use the relativelocation class and it works fine with that.

The problem occurs when I switch to a GEOLocation - none of my models show up.  

I had to enable:

<key>NSLocationAlwaysUsageDescription</key>
<string>Used for Mixed Reality Experience</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Used for Mixed Reality Experience</string>

 

Hello Alexandre,

The forum I redirected you to uses a GeoLocation example, so were you able to make it work? Please also note that, since you are using GeoLocation features you would need to update the location based on your location vallues.

Thanks
Eva

 

Login or Signup to post a comment