void SchootBlocks(){
//scene::ITriangleSelector* selector;// see down
scene::ISceneCollisionManager* collMan = smgr->getSceneCollisionManager();
irr::core::position2d<s32> mousePosition= device->getCursorControl()->getPosition();
//da modificare la texture blocco in base all blocco che si e selezionato
IAnimatedMesh *blocco=smgr->getMesh("../../media/blocco.3ds");
IAnimatedMeshSceneNode *blocconode=smgr->addAnimatedMeshSceneNode(blocco,smgr->getRootSceneNode());
blocconode->setMaterialFlag(video::EMF_LIGHTING,false);
ISceneNode *planenode;// here : create and position your planenode, horizontal;
/** here : create a triangle selector and link the selector to your planenode;
ITriangleSelector* selector;
selector = SceneManager->createTriangleSelector(planenode->getMesh(),planenode);
planenode->setTriangleSelector(selector);
or:
IMeshManipulator* meshManipulator = SceneManager->getMeshManipulator();
ITriangleSelector* selector;
selector = SceneManager->createOctTreeTriangleSelector(planenode->getMesh(),planenode,meshManipulator->getPolyCount(planenode->getMesh()));
planenode->setTriangleSelector(selector);
**/
//planenode->setTriangleSelector(selector); //done
selector->drop();
core::line3d<f32> ray;
ray.start = cam->getPosition();
ray.end = ray.start + (cam->getTarget() - ray.start).normalize() * 10000.0f;// can be longer
core::vector3df intersection;
core::triangle3df hitTriangle;
scene::ISceneNode * outNode =collMan->getSceneNodeAndCollisionPointFromRay(
ray,
intersection, // This will be the position of the collision
hitTriangle, // This will be the triangle hit in the collision
1<<0, // This ensures that only nodes that we have
// set up to be pickable are considered
0); // Check the entire scene (this is actually the implicit default)
blocconode->setPosition(intersection);
}
omgggggggggggggggggggggg it workkkkkkkkkkkkkkkkkkk i loveeeeeeeeeeeeeeeeeeeeeeee youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
BUTTTTTTTTTTT
if i move the camera the cube disappear
an advice : need to have a bird eye over the Irrlicht;
1'st, go to the Irrlicht SDK and parse the include folder; there will see alls the Irrlicht's objects and their metodes;
2'nd, go to the Irrlicht examples and parse them, one by one.
If You know c++ as You told earlier, will be very eassy to start make your application with Irrlicht;