Compilation is ok.
This is the latest version :
Code: Select all
IVideoDriver* driver; //pointer to the driver
ISceneManager* smgr; //pointer to the scenemanager
ICameraSceneNode* camera; //camera
ISceneNode* node; //dummy node
ISceneNodeAnimator* anim;
ITriangleSelector* selector;
bool finProg = false; //ending the program with the ESC key
void changeCamera(vector3df vCoord)
{
//modify the view height of the player
smgr->createCollisionResponseAnimator(
selector, camera, vCoord, // vCoord<30, Height, 30>
vector3df(0,-3,0),
vector3df(0,50,0 ));
camera->addAnimator(anim);
anim->drop();
}
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if(event.EventType == EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown){
switch(event.KeyInput.Key){
case KEY_ESCAPE:{
return finProg = true;
} break;
}
}
if(event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown){
switch(event.KeyInput.Key){
case KEY_CONTROL :{ // crouch
changeCamera(vector3df(30,50,30));
} break;
}
}
return false;
}
};
int main()
{
// (...)
changeCamera(vector3df(30,90,30)); // PROBLEM !
while(device->run() && driver && !finProg)
{
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,160,200,255));
smgr->drawAll();
env->drawAll();
driver->endScene();
}
}
device->drop();
return 0;
}