How to release component from Component Container into 3D world

Hello,
In attached layout is a Crane, which grab component Cylinder into ComponentContainer (located in Link_1). When I want to release Cylinder into 3D world, i do not know how to do - I am using second ComponentContainer_2 located in “root” of Crane. Is it possible to release Cyliner directly into 3D world?

from vcScript import *

comp = getComponent()
servo = comp.findBehaviour(“Servo Controller”)

ComponentContainer = comp.findBehaviour(“ComponentContainer”)
ComponentContainer_2 = comp.findBehaviour(“ComponentContainer_2”)

app = getApplication()
Cylinder=app.findComponent(“Cylinder”)

def OnRun():

delay(0.5)

ComponentContainer.grab(Cylinder)
servo.moveJoint(0,300)

ComponentContainer_2.grab(Cylinder)  # is it possible release "Cylinder" somewhere into 3D world ?
#without using Component Container_2 which was necessary to prepare in component Crane?

servo.moveJoint(0,0)

Crane_two_ComponentContainers.vcmx (18.5 KB)

The world root node (vcNode) has a component container behavior where you can grab the components into.

Thank you for answer, TSy, unfortunately i did not find in Help (F1) more information about this behavior. Probably it could be one or two line in Python script… but which one :slightly_smiling_face:

Try something like this:

sim = getSimulation()
world_container = sim.World.getBehavioursByType(VC_CONTAINER)[0]

world_container.grab(Cylinder)

1 Like

Yes, it is what I tried to find out. It is work, thank you for help.