[Plib-users] ssgSelector question
Brought to you by:
sjbaker
From: Allen Y. <ay...@wr...> - 2002-07-18 21:44:42
|
Hi, I have a question about using ssgSelector. I set up menu selections for the user so they can switch differnt objects. in my main root class: I am doing the following things: scene1 is ssgRoot. if (!m_OS_flag) { scene1->addKid(m_pOSBranch->ReplaceShipMode(shipMode)); m_OS_flag = TRUE; } if ((shipMode) != (m_shipMode_flag)) { scene1->addKid(m_pOSBranch->ReplaceShipMode(shipMode)); m_shipMode_flag = shipMode; } m_pOSBranch->update_OS_motion(localX,localY, localZ, Heading); In my ship class, I try to load the different objects based on the user's request: ssgEntity *OS_obj2, *OS_obj; ssgTransform *COSBranch::ReplaceShipMode(BOOL &shipMode) { if(m_OS == NULL) m_OS = new ssgTransform; ssgModelPath ( "../data" ) ; ssgTexturePath ( "../data" ) ; if (m_pStateSub == NULL ) m_pStateSub = new ssgSelector[2]; OS_obj = ssgLoad3ds ("latestSEAWOLF.3DS"); OS_obj2 = ssgLoad3ds ("02carrier.3DS"); m_pStateSub[0].addKid(OS_obj); m_pStateSub[1].addKid(OS_obj2); if (!shipMode) { m_pStateSub->selectStep(1); m_OS->addKid(&m_pStateSub[1]); } else { m_pStateSub->selectStep(0); m_OS->addKid(&m_pStateSub[0]); } return m_OS; } My problem is that the old object didn't get deleted when the new objects load into the scene. How can I solve the problem? Please help me out |