Re: [Plib-users] It's Possible???
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-03-19 18:52:36
|
Horacio Sanson wrote: > I want to have two 3d objects to be defined separately and in some point make > them part of the same object, so any transformation affects both objects > equally. Is this possible??? Yes. You need to visualise the SSG scene graph as a tree: parent node | _______________|_______________________ _ _ _ _ _ _ _ | | | Player_ssgTransform Sword_ssgTransform Rooms,Dragons,etc | | ________|________ | | | Sword_ssgBranch Body_ssgBranch Arm_ssgTransform | | | | Body_ssgLeaf(s) Arm_ssgBranch Swort_ssgLeaf(s) | Arm_ssgLeafs When the player picks up the sword you should probably do the following: add the Sword's ssgTransform node to the Arm's ssgBranch removeKid the Sword's ssgTransform from the parent node change the Sword's transformation to position it in the player's hand relative to his arm. >From then on, the sword will stay 'glued' to the player's hand. The scene graph should now look like this: parent node | _______________|_______________________ _ _ _ _ _ _ _ | | Player_ssgTransform Rooms,Dragons,etc | ________|________ | | Body_ssgBranch Arm_ssgTransform | | Body_ssgLeaf(s) Arm_ssgBranch |______________________ | | Arm_ssgLeafs | Sword_ssgTransform | | Sword_ssgBranch | | Swort_ssgLeaf(s) Make sure you add the sword to the player *before* you detach it from the parent node because SSG deletes nodes that are no longer connected into the scene anywhere. In general, you could use this to place the sword onto moving vehicles, to make the player ride a horse, etc, etc. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |