Get size of imported model with API
Posted: 07 Oct 2019, 10:50
Hi Everyone,
I do not know if I catch a bug or I am just badly using one API's function
I'm progressing in my sorting chain project, and now, I aim to generate multiple type of cans from models that I created.
These cans do not have the same size and I do not want to hard code each of them.
So, to get cans' size, I thought about using
The code used is:
I firstly tried to import my model (which is a customized Cylinder of size 8x8x8.5 cm) then I tested to create a Cylinder with PureShape, but I both cases sim.getObjectSizeValues gave me {1,1,1} and the variables a & b (which should give boudingboxes min/max on x axis) give also 1.
Do you have an idea why I'm not getting expected results ?
Cheers
I do not know if I catch a bug or I am just badly using one API's function
I'm progressing in my sorting chain project, and now, I aim to generate multiple type of cans from models that I created.
These cans do not have the same size and I do not want to hard code each of them.
So, to get cans' size, I thought about using
sim.getObjectSizeValues
, nevertheless I do not get result I expected.The code used is:
Code: Select all
h=sim.createPureShape(partType,19+4,{0.08,0.08,0.085},1,nil)
--h = sim.loadModel("models/mine/can_texture.ttm")
sim.setObjectParent(h,model,true)
--can_shape={0.08,0.08,0.085}
can_shape = sim.getObjectSizeValues(h)
a = sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_min_x)
b = sim.getObjectFloatParameter(h,sim.objfloatparam_objbbox_max_x)
print(can_shape)
print(a,b,(b-a))
Do you have an idea why I'm not getting expected results ?
Cheers