i am trying to develop a 3-d modelling tools using three.js ......
i have just used ur examples to render 3d objects in wire frame platforms !
now i want to resize the 3d objects using mouse dragging events or by scaling the 3d object by clicking on a button !
awaiting fo ur reply !
The Mesh
object has the scale
property. Just do mesh.scale.x = 2
or mesh.scale.set( 2, 1, 1 )
.
i have the same problem as the guy over there: http://stackoverflow.com/questions/19150120/scaling-an-object-in-three-js
the moment i change scale i get flooded with:
"Matrix3.getInverse(): can't invert matrix, determinant is 0"
in three-r73.js:4482:5
I get the same error. Using THREE.CylinderGeometry
@gunderson Try stackoverflow if you need help.
If you have a group of objects, try to add them to a group as _rendering parent_ and scale the parent...
const renderingParent = new THREE.Group();
// ...
renderingParent.scale.set(2,1,1);
renderingParent.add(groupOfObjects);
What if I am constantly changing? (I don't want to calculate scales 10 times)
Isn't there a method that actually changes the geometry width and height?
Best, Luis
@luisArandas Please use the forum or stackoverflow for help requests.
For box geometries look like constructor !== scale. If I change the scale to x = 1, when my object is BoxBufferGeometry(1,1,1); it shows REEEEALY different views of my objects. Is it normal? It's just really crush my game, when after setting =-1 size my object getting only bigger.
Here is some screenshoots. So first number in console is size of x,y,z for player cube, and when i use
cubeSize.xyz = cubeSize.xyz - 1;
cube.scale.set(cubeSize.xyz, cubeSize.xyz, cubeSize.xyz)
it look like he stayed at the same size after getting smaller, but make it down with Y position and when i use after
cubeSize.xyz = cubeSize.xyz + 1;
cube.scale.set(cubeSize.xyz, cubeSize.xyz, cubeSize.xyz);
it makes it being much more, than it was seted by box geometry, however, you can't see that variable becomes just 2 again. I can't tell you why it is, but for me, seems scale have different sizes, than constructor. Maybe scale is using meters and geometry foots, I don't know.
Is it only can be my problem, or bag of three js version 101? (100 actually look work same)
I kindly suggest you, @dygy, to move the question to the forum if you want to get a proper answer: https://discourse.threejs.org/
Most helpful comment
The
Mesh
object has thescale
property. Just domesh.scale.x = 2
ormesh.scale.set( 2, 1, 1 )
.