Why does scale and setting geometry looks different?

I even have use a if (cubeSize.xyz > 0.1) { to this deal, it’s nothing about negative as you can see in my chrome console

Look how it is when I try to do it bigger at float numbers. I don’t move it, just scale it to +0.1 2 time (websoket’s problem, still 0.4 < than 0.2, that’s really wierd)
image
image

Um, to be honest your problem is not clear to me, sry. Any chances to demonstrate the issue with a simple live example?

T and Y to resize, sorry for websockets
https://jsfiddle.net/hyen3fqb/

Sometimes forums don’t reply to you after i press it, so i’m sorry

sorry for DDoS also, but press f12 to see the numbers, they are really great.

The scenario of adding 0.1 to size (which is also a float) are really specific image
And the sizes after first operation really seems to use not same metrics as it was from setting geometry.

And yeah, I know that JS have some magic with floats, but still rounding does not change the fact of become smaller, after trying to make it bigger.(i really tried it)

The difference between 5.0 of geometry settings and scale settings be like
image

I’m sorry but I really don’t understand the difference between the actual and your expected result. Can you please reproduce the problem with a smaller test case (not your app)?

the cube with oppacity and moving cube on last picture have the same size by three js, but have different size in real vision. when i use
cubeGeometry = new THREE.BoxBufferGeometry( cubeSize.xyz, cubeSize.xyz, cubeSize.xyz);
it becomes different frome
cube.scale.set(cubeSize.xyz,cubeSize.xyz,cubeSize.xyz)

i want to set scale with the same metric, that uses BoxBufferGeometry, to make a game logic understandable and possible. After FIRST time you will use scale it will make your work use another metric, like BoxBuffer is meters, and now it’s foots, so everything become smaller.That how i see the three js problem in my project

I’m afraid I’m unable to reproduce: https://jsfiddle.net/cL7pzrbu/

if you do
let mesh2 = new THREE.Mesh( new THREE.BoxBufferGeometry(4,4,4), material );
mesh2.position.x = - 5;
mesh2.scale.set(4,4,4);
scene.add( mesh2 );
you will have my problem. So i just don’t understand a logic of work of it, and how i can change smth, that seted by geometry. If you can give me some knowlege, i won’t regret it. Sry if i looked rude.

And if you can help me in one more thing, what is the math logic of position of the lowest ribs of box, while it change the scale, maybe some formula. I know its almost same at 3dmax and etc, but still, want to now, how i need to transtaleY for make my box stay on ground after scaling.

What’s the problem in your last example. When I do what you describe I’ll just have a mesh, not a problem.

Three.js is unit agnostic, the units have a meaning only if you give them one.

The problem in all this post is:
THREE.BoxBufferGeometry(4,4,4), material );
mesh2.scale.set(4,4,4);
!=
(
THREE.BoxBufferGeometry()
mesh2.scale.set(4,4,4);
||
THREE.BoxBufferGeometry(4,4,4), material );
)
It looks like change metric(like from meters to inches for 1m=1inch), like it render and work logically after first time, but it makes you object to be made change size like 3x less.

Look this photoimage
5 is scale of moving cube at box-ground and another 5 is scale of opacity one. Do they look ===?

No but they shouldn’t three different cubes with three different transformations. There are no meters and inches involved.

How do i scale if i selected geometry normally ?

I don’t say it is, i just shared my exp of how i see it, i think the one that used 3dmax would understand.

I used 3ds max for 20 years but I’m afraid I don’t understand at all what you need :frowning:

Don’t take it, it was different usage. I ask, how do i scale the object, that was settled by geometry to make it look like it was seted by geometry? Like
I set geometry (4,4,4)
How do i change scale to make it look now as geometry (5,5,5).

var geom = new THREE.BoxBufferGeometry(4, 4, 4);
var mesh = new THREE.Mesh(geom, some_material);
mesh.scale.setScalar(1.25)

The result is a box of 5 x 5 x 5.
The size you want divide by the size you have thus you’ll get the desired scaling value.
You want 5, you have 4, then 5 / 4 = 1.25.

3 Likes