Generating wireframes TypeError

// initialize code called once per entity
Rotate.prototype.initialize = function() {
    var cloned = new pc.Model();
    cloned = this.entity.model;

TypeError: cloned.generateWireframe is not a function

What am I doing wrong? Thanks.

pc.Model isn’t the model component of the entity as confusing as it sounds. The model component that gets added to the entity has an internal reference to pc.Model.

// initialize code called once per entity
CreateModel.prototype.initialize = function() {
    this.entity.addComponent('model', {type: 'box'});
    var model = this.entity.model;
    for (var i = 0; i < model.meshInstances.length; i++) {
        model.meshInstances[i].renderStyle = pc.RENDERSTYLE_WIREFRAME;