Hello,
I am Trying to Scale Object.but I am not able to scale object from particular point.
I don’t under stand what your are trying to do. Can you try explaining more clearly? If you can provide an example of your code too that would be great.
Hii,
Suppose if we want to scale a cube then we have inbuild scale properties to do that but by default it take position point as scale point,means if a cube position is at origin (0,0) then it will scale from that point and suppose if we don’t want to scale the cube from origin point then we have to change the position of that cube.I don’t want to change the position of cube. I want to scale the cube from that point where every i hit the mousedown. Just like in AutoCad. In Autocad where every we hit from that point the object is starting scaling.
It sounds like a simple scale task, after that you need to translate the cube geometry position.
Checkout boundingBox.getCenter() command, It can give you good insights to apply the translation.
Scaling/transforming the geometry works, but loses a bit of precision with each operation. In the context of an editor it’s often better to create a new Object3D or Group at the point you want to center around… call it pivot…
do something like:
let saveParent = theObject.parent;
pivot.attach( theObject );
then scale/rotation pivot how you want.. then
saveParent.attach(theObject);
This avoids modifying the actual vertices, and any precision drift is only on the position/rotatation of the object (which is also not as bad as transforming vertices since pos/rot of Objects is done w 64 bit javascript floats, vs transforming geometry which is transforming 32 bit floats.