Confused about the use of "Drop" in Collision tuto
Posted: Fri Dec 21, 2007 10:22 am
First the selector is initialized:
Then it is used to add collision response to the camera:
Then it is dropped:
Then it is used again without being reinitialized:
Why does this work? Is one of the functions selector is passed to grabbing it? If so, is this well-defined behavior or was this a mistake? Or am I misunderstanding how drop is used?
Code: Select all
scene::ITriangleSelector* selector = 0;
if (q3node)
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));
selector = smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
}
Code: Select all
if (selector)
{
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-1,0),
core::vector3df(0,50,0));
Code: Select all
selector->drop();
camera->addAnimator(anim);
anim->drop();
}
Code: Select all
if (smgr->getSceneCollisionManager()->getCollisionPoint(
line, selector, intersection, tri))
{