How to release created component to world?

Hey,

how can I remove the parent and container of a created component?
I tried part.Container.remove(part) but it is still there

Hy,

grab the part into another container?

Regards
Feature

I don’t want it to be in any container just like a roboter for example.

Dynamic components always need to have some parent/container. If no other component, then at least the simulation world.
You can access that through the API vcSimulation.World and it’s of type vcNode.

Where would the part go for next step?
Some solutions there, but it depends on different situations.
The best practice is to describe more about your situation.

I already attach the component to simulation World to have it as its parent.

If a component is on a path I need to either delete and create a new component to change it’s position using PositionMatrix or I need to create a different container, grab the comp, change it’s position and then grab it with the path. If I can remove the container or take it out of the path I wouldn’t need the other container.

Using physics it happens that I need to create and position a component at a certain location and don’t want it to be contained in a container of the previous location but I also don’t want to specifically create a container at every possible location because I am using physics. Also if I immediately change the position of a created component it doesn’t work unless I use delay(0.001) or use grab.

That’s why I personally would like to remove the container of the component and attach it to the world.

No need other container to grab it, the magic method is “MovementOrigin”

matrix = part.MovementOrigin
part.translateRel(0.0, 0.0, 100.0)     
part.MovementOrigin = matrix

That method moves the start and endpoint of the path for that particular component. If I move it 500 mm in the x direction it will go those 500 mm after the end of the conveyor too.

So after offset the part, you want the part stay still or … ?

What is your final goal, I mean, like, you want parts to move in specific curve, or you want parts to turn right, or you want parts to drop down vertically or … there could be another way to solve it.

To follow the rest of the path normally. I have a sensor at the middle of every conveyor. If I get a signal from the real system and my sensor shows no signal then I want to move the nearest component to that sensor. After placing it there it should follow the rest of the path normally.

My solution was to either remove the nearest component and just create a new component at that point and grabbing it with the path or grabbing it with another container, position it and then grabbing it with the path.

Those solutions require extra behaviours only for the positioning since grabbing it with the same path twice doesn’t work so I thought removing the component from the path (container), positioning it and then grabbing it with the same path again would be better.

Something like this … ?
Untitled