Transforming object from a given point



i am new to three.js and i am currently doing move,rotate,and scale on a cube. if i want to move a cube then i use to assign this values i.e cube.position.x and cube.position.y, and the cube move from its position.But i want to move that cube from a particular point like in c# there are methods like RotateAt, ScaleAt which gives us the provision from which point you want to transform your object.Is there are methods like this in three.js beacuse i didn’t find any of this.

Thanks & regards

The basic operation of mesh in obj model

Hi Gaurav, apologies for the late reply.
There are basically two ways of achieving this - you can either translate / scale / rotate the geometry within the mesh so that the centre of the mesh object is at the point you want to scaleAt, rotateAt etc ( called the transform or pivot point) , while the geometry is at the position you want to display the object. Note that operations on geometries are expensive so you should move the geometry a minimum number of times relative to the mesh.

Or you can leave the geometry at it’s default position (centred) within the mesh and add the mesh as a child of a THREE.Group. Position the group at the point you want to transform around and the mesh relative to it. The group is now the pivot point for your object.
This is the option you should choose if you are moving the mesh relative to the pivot point frequently as it should perform better.


Thanks a lot , It works and begin to rotate, scale and transform from a particular point.I use THREE.Group and add my object as a child and it works,But i have one more question.I am using buffergeometry and i have added position attribute just like every buffergeometry but when i transform the group the vertices point of the object is not updating.As my object is a child of group.Is there any method to do this.