As we all know, there are many ways to attach a component to another component in Visual Components. You can use grab(), attach or drop operations in the direction of gravity. But I think attach has a very strange problem in my opinion. We know that you can specify a component in HOME to perform additional operations, you can also perform additional operations in PROCESS, you can also implement robot placement and other similar operations in PROGRAM, and there is also the “a.attach(b)” of the Python script . What makes me feel strange is that the effects of the first three are very calm, while the effect of Python seems very intense. I mean, from an effect perspective, the first three don’t cause the PositionMatrix property to change, whereas using attach in Python would cause the entire simulation world to be completely messed up. So I really hope someone can tell me in detail the difference between them and how to solve this problem.
Thanks in advance to everyone who replies and have a great day!
How the positioning of objects in the 3D works is that each object’s position is defined relative to its parent, so if the parent moves the object moves with it.
vcNode.attach(…) method doesn’t change the relative position to parent, but the parent changes, so the position in world coordinates may change. You can simply read the world position, attach and then assign the world position back again which calculates the appropriate position relative to the new parent.
The other methods like ribbon commands just do the same thing for you.
See the examples in the Python API help.
So cool , looks like I missed something so interesting, thanks so much for your quick reply, it allowed me to make something interesting.