My code compiles great and seems to work one time lol..
Im working with event recivers and had simalar problem when doing my cursor and cam on and off settings...
The code loads one time and then never returns back to see my events when they accour...
Below is some code..
int spa = 100.0f;
int spb = 1000.0f;
int speed = spa;
int gravity = 0;
int gra = -40;
bool sp = true;
bool gr = true;
// the events below //
}
if ((event.EventType == EET_KEY_INPUT_EVENT) &&
!event.KeyInput.PressedDown){
switch(event.KeyInput.Key){
case KEY_SPACE:{
gr = !true;
}
}
}
if ((event.EventType == EET_KEY_INPUT_EVENT) &&
!event.KeyInput.PressedDown){
switch(event.KeyInput.Key){
case KEY_SHIFT:{
return sp = !true;
}break;
}
}
return false;
}
};
// the parts im wanting to control on the cam //
// cam //
// notice speed, and gravity //
if(gr){
gravity = gra;
}
if(sp){
speed = spb;
}
scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0,70.0f,(speed));
camera->setPosition(core::vector3df(7000,1100,4000));
camera->setFOV(1.0f);
camera->setFarValue(20000.0f);
scene::ISceneNodeAnimator* anim = 0;
anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,10,30),
core::vector3df(0,gravity,0), 100.0f,
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();
Ok this code works to an extent..
If i set the gr,sp to true or false the if statements work..
But the code seems to only be making one pass over the events and not returning and then reloading the cam code when the changes are made by the events...
So even though the events may be working the cam code isnt being reloaded to reflect the changes...
How would i go about changing this to reload the cam code ?
maybe a while loop but then would the program be stuck in the loop and never move to the next section of code..?
I gues im just haveing a simple missunderstanding of how the flow of the program works and how to control it..
Any help on this I would be very thankfull...
Oh and this code is going to be changed a bunch more after I figure out how to get what ive got here working...
But the basic idea is to be able to togle from walking speed to running speed with the shift key.. Latter on im going to change this code by setting it up so that the event is only when the key pressed insted of toggling...
I dont think ill have any problems with mulitple keys being pressed like the arrows while walking and then pressing the shift key at the same time...
The gravity will be changed to only have a gravity setting durring any movement keys.. like any of the arrow keys and then when the key is released the gravity will be changed back to 0 as to not pull you down hills...
I latter on want to change this to be reflected with the triangle collision insted and as long as collision is present then the gravity will be 0 but anytime the collision isnt present then the gravity will set on again... This way lets say you jump from a top of a building as long as the character isnt colliding with anything then the gravity will be on and pull the character down and then when collision is present again then it will be set back to 0 again...
I hope everyone understands what im working on and also hope that it gives others the same kinda ideas in hopes to simplify using irrlicht and not to have to worry about incorporating physics of another sort...
It may be generic but it should work very well when I get it working...
Again thanks for any help on this...