Start a new topic

3d model does not show animation

Hello Friends of Wikitude,

I will be working with the 3D Modelatgeolocation example.

I try to create a poi with a 3d animation that works correctly in Wikitude3dEncoder. But when seeing in camera view, the model has no movement. What are you doing wrong?

This is my code;


var World = {

 loaded: false,

 rotating: false,


 init: function initFn() {

  this.createModelAtLocation();

 },


 createModelAtLocation: function createModelAtLocationFn() {


  /*

   First a location where the model should be displayed will be defined. This location will be relativ to the user. 

   //(null, 5, 0, 2) 

  */

  var location = new AR.RelativeLocation(null, 5, 0, -100);


  /*

   Next the model object is loaded.

  */

  var modelEarth = new AR.Model("assets/arana3.wt3", {

   onLoaded: this.worldLoaded,

   scale: {

    x: 1,

    y: 1,

    z: 1

   } 

   

 

  });


        var indicatorImage = new AR.ImageResource("assets/indi.png");


        var indicatorDrawable = new AR.ImageDrawable(indicatorImage, 0.1, {

            verticalAnchor: AR.CONST.VERTICAL_ANCHOR.TOP

        });


  /*

   Putting it all together the location and 3D model is added to an AR.GeoObject.

  */

  var obj = new AR.GeoObject(location, {

            drawables: {

               cam: [modelEarth],

               indicator: [indicatorDrawable]

            }

        });

 },


 worldLoaded: function worldLoadedFn() {

  World.loaded = true;

  var e = document.getElementById('loadingMessage');

  e.parentElement.removeChild(e);

 }

};


World.init();


-

thanks

1 Comment

Hello,



for an animation of an AR.Model to be played, you need to create an AR.ModelAnimation object and call start() on it. I don't see this happening anywhere in the snippet you posted.


I'd recommend having a look at the 3D model animation samples, which we also provide with the sample app, or the corresponding JavaScript API reference page.



- Daniel

Login or Signup to post a comment