but whithout the particle effects
basicly i need to know how to set a straight line animator calculate the position from the camera to where im looking then create a formula to how long its going to be to get there so ive studied the demo but there are all these confusing variable and functions i dont know how to deal whith so if anyone can help me it would be greatly appreaciated
oh yeah heres the code im using:
Code: Select all
#include <irrlicht.h>
#include <irrklang.h>
#include <iostream>
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
int main()
{
IrrlichtDevice *device =
createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(640, 480), 16, true);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
device->getFileSystem()->addZipFileArchive("../media/map-20kdm2.pk3");
scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* q3node = 0;
scene::IAnimatedMesh* pistol = smgr->getMesh("../media/pistol.3ds");
scene::ISceneNode* pistolnode = 0;
if (q3levelmesh)
q3node = smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));
if (pistol)
pistolnode = smgr->addOctTreeSceneNode(pistol->getMesh(0));
scene::IAnimatedMesh* pbullet = smgr->getMesh("../media/pistol bullet.3ds");
scene::ISceneNode* bulletnode = 0;
if (pbullet)
bulletnode = smgr->addOctTreeSceneNode(pbullet->getMesh(0));
scene::ITriangleSelector* selector = 0;
pistolnode->setPosition(core::vector3df(5,17,10));
if (q3node)
{
q3node->setPosition(core::vector3df(-1350,-140,-1410));
selector = smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
}
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 0, true);
camera->setPosition(core::vector3df(0,50,0));
if (selector)
{
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
selector->drop();
camera->addAnimator(anim);
anim->drop();
}
device->getCursorControl()->setVisible(false);
scene::ISceneNode* selectedSceneNode = 0;
scene::ISceneNode* lastSelectedSceneNode = 0;
pistolnode->setParent(camera);
int lastFPS = -1;
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"test[";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
}