model position adjustment problem

Typically: "How do I... ", "How can I... " questions
Post Reply
huihui
Posts: 15
Joined: 15 Apr 2022, 08:51

model position adjustment problem

Post 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?

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: model position adjustment problem

Post 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

Post Reply