set joint position to 0, while keeping child-object in place

Typically: "How do I... ", "How can I... " questions
Post Reply
MaJiamu
Posts: 32
Joined: 19 Jan 2021, 03:52

set joint position to 0, while keeping child-object in place

Post by MaJiamu »

How should I quickly and easily achieve in a scene where all objects maintain their current position and orientation, while leaving the position of each joints at 0?
https://drive.google.com/file/d/17vmBiD ... drive_link
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: set joint position to 0, while keeping child-object in place

Post by coppelia »

Hello,

you have several possibilities. Easiest would probably to parse all joints in the scene, temporarily detach their children, set the joints to zero, then reattach the children.
For that, use sim.getObjectsInTree, sim.getObjectParent and sim.setObjectParent

Cheers
MaJiamu
Posts: 32
Joined: 19 Jan 2021, 03:52

Re: set joint position to 0, while keeping child-object in place

Post by MaJiamu »

coppelia wrote: 07 May 2025, 07:48 The IK in the scene seems to prevent setting the joints to 0.
How can I set another script to disable in one script, by the way, my version of CoppeliaSim is v4.6. I can't seem to find the user manual for the old version anymore.
I tried to use the function

Code: Select all

sim.setScriptStringParam(scriptHandle,sim.scriptintparam_enabled,XX)
, but I don't know if it's correct or what value XX should be set to in order to make the script disable.
The IK in the scene seems to prevent setting the joints to 0.
How can I set another script(for example the IK script) to disable in one script, by the way, my version of CoppeliaSim is v4.6. I can't seem to find the user manual for the old version anymore.
I tried to use the function

Code: Select all

sim.setScriptStringParam(scriptHandle,sim.scriptintparam_enabled,XX)
, but I don't know if it's correct or what value XX should be set to in order to make the script disable.
coppelia
Site Admin
Posts: 10747
Joined: 14 Dec 2012, 00:25

Re: set joint position to 0, while keeping child-object in place

Post by coppelia »

The user manual is also offline, in your CoppeliaSim folder.
But I highly recommend to upgrade to the latest version.

sim.scriptintparam_enabled is an int parameter as the name says. So it should be:

Code: Select all

sim.setScriptInt32Param(scriptHandle, sim.scriptintparam_enabled, zeroOrOne)
Cheers
Post Reply