Hi everybody, sorry for my english!
i have taken the code structure from the techdemo.
now when i move the player thecamera follows him turn with him but look a the start position of the player.
here is the soure: http://www.homepage.hispeed.ch/rude/rfx/RFXBase001.cpp
thx
Camera looks at start Position
If I guessed your problem, the solution should be in one other thread but actually I can't find it so here it is what to do: add in the main loop (drawing loop) the following code pcamera->setTarget(Player1node->getPosition()); I think that is a bug of the camera but you can solve it in this way. I hope this could be of any help!
P4 2.53MHz 256MB GeForce4Mx VC++6.0
Thx for your help, but i had try out this way, (i had read the other threads disscusing this problem ) but when i do that in the draw loop like this:
while(device->run() && driver)
{
if (device->isWindowActive())
{
// load next scene if necessary
u32 now = device->getTimer()->getTime();
if (now - sceneStartTime > timeForThisScene && timeForThisScene!=-1)
switchToNextScene();
pcamera->setTarget(Player1node->getPosition());
// draw everything
driver->beginScene(true, true, backColor);
smgr->drawAll();
guienv->drawAll();
driver->endScene();
// statistics
swprintf(tmp, 255, L"%s fps:%d polys:%d", driver->getName(),
driver->getFPS(), driver->getPrimitiveCountDrawn());
statusText->setText(tmp);
}
}
it compiles but the app crash at start
while(device->run() && driver)
{
if (device->isWindowActive())
{
// load next scene if necessary
u32 now = device->getTimer()->getTime();
if (now - sceneStartTime > timeForThisScene && timeForThisScene!=-1)
switchToNextScene();
pcamera->setTarget(Player1node->getPosition());
// draw everything
driver->beginScene(true, true, backColor);
smgr->drawAll();
guienv->drawAll();
driver->endScene();
// statistics
swprintf(tmp, 255, L"%s fps:%d polys:%d", driver->getName(),
driver->getFPS(), driver->getPrimitiveCountDrawn());
statusText->setText(tmp);
}
}
it compiles but the app crash at start
not a bug persay...
well its not a bug persay, really what it is, is that the camera _is_ attached to the player, it has the player's translation and rotation, but its target does not. there are definitely instances where you would WANT this to be the case, but for most people, including me, the target is the thing you want to be attached, not necessarily the camera itself. I'm not certain, but i dont think the irrlicht camera really provides the functionality to attached the _TARGET_ of the camera to a given sceneNode, though that would certainly rock
for now, as keanu says the only real way to do it is to do a camera->setTarget(playervector); every run through the render loop(or perhaps just when the player's position changes)
-Ted
for now, as keanu says the only real way to do it is to do a camera->setTarget(playervector); every run through the render loop(or perhaps just when the player's position changes)
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net