Start a new topic

"Model" class

"Model" class


Hi, i want to add some 3D objects (.wt3) on my project and saw examples that uses Model and animation to add this object, but i can't instanciate this 3D object. I ask if there are class or library for the resolution of this problem?

Code : 

// instantiate the model object

var model = new AR.Model("butterfly.wt3");

// instantiate the model animation with the animation id

var animation = new AR.ModelAnimation(model, "butterfly_animation");

// start the animation animation.start();

Hi,
first check if you included the architect.js file in your HTML:

<script src="architect://architect.js"></script>


second, start the animation only after the 3d model has been loaded. Therefore implement the onLoaded function of the AR.Model.

var modelUri = "butterfly.wt3";
var animationName = "butterfly_animation";

var model = new AR.Model(modelUri, {
onLoaded : function()
{
var animation = new AR.ModelAnimation(model, animationName, {
onStart: function(){
console.log("animation started");
},
onFinish: function(){
console.log("animation finished");
}
});
animation.start(-1);

}});


Hope that helps,
Christian

Hi,

I have the same problem and i want to know what do you mean includ js file in the HTML is it the AndroidManifest ?

 

Please have a look at the documentation. There is a detailed description how to setup an AR View.

Hi,in which HTML file i must to includ this code of architect.js :<script src="architect://architect.js"></script>

should i includ it in activity_main.xml or in AndroidManifest.xml file.

Hi Jbeli,

Please have a look at the sample application which is included in the SDK download package. You can see there in detail in which .html file (not an .xml) should be included and how it's handled.

Greetings

Nicola

 

Thank's Nicola, the problem was solved.
Login or Signup to post a comment