Математика |
addChild Usage -- Lingo syntax member(whichCastmember).node(whichParentNode).addChild(member\ (whichCastmember).node(whichChildNode) {,#preserveWorld}) // JavaScript syntax member(whichCastmember).node(whichParentNode).addChild(member\ (whichCastmember).node(whichChildNode) {,symbol(preserveWorld)}) Description 3D command; adds a node to the list of children of another node, and removes it from the list of children of its former parent. An equivalent to this method would be to set the parent property of the child node to the parent node. Parameters addMemberRef Required. A reference to the cast member that contains the node to add. addNodeRef Required. A reference to the node to add. This node can be a model, group, camera, or light. symPreserveParentOrWorld Optional. A reference to the camera to add to the list of cameras for the sprite. Valid values are #preserveWorld or #preserveParent. When the child is added with #preserveParent specified, the parent-relative transform of the child remains unchanged and the child jumps to that transform in the space of its new parent. The child’s world transform is recalculated. When the child is added with #preserveWorld specified, the world transform of the child remains unchanged and the child does not jump to its transform in the space of its new parent. Its parent-relative transform is recalculated. 234 Chapter 12: Methods Example This statement adds the model named Tire to the list of children of the model named Car. -- Lingo syntax member("3D").model("Car").addChild(member("3D").model("Tire")) // JavaScript syntax member("3D").model("Car").addChild(member("3D").model("Tire")); This statement adds the model named Bird to the list of children of the camera named MyCamera and uses the #preserveWorld argument to maintain Bird’s world position. -- Lingo syntax member("3D").camera("MyCamera").addChild(member("3D").model ("Bird"), #preserveWorld) // JavaScript syntax member("3D").camera("MyCamera").addChild(member("3D").model ("Bird"), symbol("preserveWorld"));
|