Can't change position of entity

Hi,

I have mesh on scene - this is a plane, and i need to put Spheres at each point of this plane.
I do following:

initialize: function () {
        var i = 0, meshInstance = null;
        for( ; meshInstance = this.entity.model.model.meshInstances[i++]; ) {
            if (0 === meshInstance.node.name.indexOf('Plane_')) {
                this.plane = meshInstance;
                break;
            }
        }

        if (null === this.plane) { // i pass this always with no error
            console.error('Could found Plane mesh of model:' + entity.name);
            return;
        }

        if (this.plane.mesh.vertexBuffer.numVertices < 4) { // i pass this always with no error
            console.error('Plane mesh has unexpected count of vertices. There gotta be at least 4 vertices.');
            return;
        }

        var vertexBuffer = this.plane.mesh.vertexBuffer;

        var vertices = new Float32Array(vertexBuffer.storage);
        var size = vertexBuffer.format.size / 4; // bytes -> float32

        for(var vertexIndex = 0; vertexIndex < 4; vertexIndex++) {
            
            var point = new pc.fw.Entity();
            
            var pos = new pc.Vec3(
                vertices[vertexIndex * size], 
                vertices[vertexIndex * size + 1], 
                vertices[vertexIndex * size + 2]);
                
                
        point.setName('point_' + vertexIndex);
                            
            context.systems.model.addComponent(point, { type: 'sphere' });
            
            this.entity.addChild(point)

            point.setScale(0.5, 0.5, 0.5);
            
            point.setPosition(pos);
            
        }
        // .... 

The problem is that method setScale, setLocalScale, setPosition, setLocalPosition, translate does not make any effect on point - why?

point and Sphere attached to the point always stay at ceneter of scene. what I do wrong.

There is no function setScale on an entity. You should use setLocalScale().

Apart from that it looks reasonable. Do you have a project link I could take a look at?


Aside, it’s just worth pointing out:

context.systems.model.addComponent(point, {type: 'sphere'});

Can now be replaced with:

point.addComponent("model", {type: 'sphere'});

Also, the context var which used to be passed into the script create method is now an instance of the pc.Application and is generally called app in all new scripts.

Thanks.
setScale was a reason of problem. Looks like i missed error messages about setScale becouse of tons other debug information. Now it works fine.