Connect 2 cuboids to one Shape

Typically: "How do I... ", "How can I... " questions
Sena
Posts: 9
Joined: 13 Jun 2022, 15:21

Re: Connect 2 cuboids to one Shape

Post by Sena »

Sorry for my bad explanation

Here is the image : https://ibb.co/4syxx8M
(red : cuboid / blue : cylinder)

So i'm controlling the position of L_Elbow & L_Shoulder via Python.
And i want the cylinder to follow those cuboids as you can see in my drawing .
Is it possible ?

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

Re: Connect 2 cuboids to one Shape

Post by coppelia »

Finally!

Ok, you have severasl ways. Normally, you would use inverse kinematics to do that. e.g.:

Code: Select all

shoulder --> sphericalJoint --> arm --> dummyTip
elbow --> dummyTarget
maybe even something like:

Code: Select all

shoulder --> sphericalJoint --> arm --> sphericalJoint --> dummyTip
elbow --> dummyTarget
Just make sure your shapes are not dynamic. And have a look at the simple IK example in scenes/singleIkGroupWithSingleIkElement-undamped.ttt

Another possibility of course would be to compute the position and orientation of the arm, and update it via sim.setObjectPosition, sim.setObjectOrientation and/or sim.setObjectMatrix. Here too, make sure that your shapes are static.

Cheers

Post Reply