I try to rotate a primitive（The primitive has 1000 rectangles, each with its own location）, but when i use code like this, i find position be changed at same time.how could i do to make it right. can any one help me?（the oldModelMatrix is default modelMatrix）

let matrix3=Matrix3.fromRotationY(Math.toRadians(angle));

let rz = Matrix4.fromRotationTranslation(matrix3);

let result = Matrix4.multiply(oldModelMatrix, rz, oldModelMatrix);

Hi,

Welcome to the community! Could you please share a Sandcastle showing how you’re constructing the primitive and updating its matrix?

Thanks,

Eli

i got a primitve with 1000 rectangle by

let myprimitive = new Primitive({

geometryInstances: [myGeometrys],

appearance: new PerInstanceColorAppearance()

})

and the **myGeometrys** is an Array of rectangle geometryInstance, like:

let myGeomInstance = new GeometryInstance({

geometry: new RectangleGeometry({

rectangle: Rectangle.fromDegrees(

west,

south,

east,

north

),

}),

attributes: {

color: ColorGeometryInstanceAttribute.fromColor(Color.RED),

},

})

and after added it to **Viewer**, i try to rotate the primitive by **modeMatrix**, i use:

let matrix3=Matrix3.fromRotationY(Math.toRadians(angle));

let rz = Matrix4.fromRotationTranslation(matrix3);

let result = Matrix4.multiply(myprimitive.modelMatrix, rz, new Matrix4());

It’s work, but primitive’s position has been changed at same time.Then i try to get center of primitive position to reset the primitive rotate origin point

let center = Transforms.eastNorthUpToFixedFrame(centerPosition);

And primitive fly to another position(have a height that i never set).

I’m confused by the rotation of ModeMatrix. Is there anything I haven’t noticed?