Page 1 of 1

model position adjustment problem

Posted: 19 May 2022, 15:10
by huihui
I want to place a small ball on a table, how can I adjust the position of the ball in the world coordinate system so that the ball is exactly on the table, and its spherical surface is tangent to the table?

Re: model position adjustment problem

Posted: 20 May 2022, 14:15
by coppelia
Hello,

this depends how your table model and sphere models were defined. E.g. let's suppose that your sphere reference system is located at the center of the sphere, and the table reference system is on the floor, centered under the table, and aligned with the world reference system. Then you could simply do:

Code: Select all

sim.setObjectPosition(sphereHandle,tableHandle,{0,0,tableHeight+sphereRadius})
You can do many more things via matrix and transformation operations.

Cheers