class MyEventReceiver : public IEventReceiver
{
public:
bool OnEvent(const SEvent& event)
{
if (event.EventType == EET_KEY_INPUT_EVENT && !event.KeyInput.PressedDown)
{
switch (event.KeyInput.Key)
{
// Jump
case KEY_SPACE:
camera->setPosition(camera->getPosition() + vector3df(0, 400, 0));
return true;
it works, but the camera is suddenly at the new place(+400).
For jumping it would be better if it go not suddenly but slowly in the air and slowly back (this i made with gravitiy).
How can i make that i jump slowly up and not suddenly?
thx
Make jump a 'state' feature of your code, like a bool flag. If this flag is set, call the jump function and increment/reach height/decrement your Y position. Let your x/z momentum carry you forwards (eg, don't touch them). when your Y value is back to 0 or you collided with ground, turn off the bool jump flag.
rogerborg wrote:The FPS camera has basic jump functionality
Can you tell me more about that basic jump functionality please?
All I know off-hand is that there is an argument in the addCameraSceneNodeFPS() function which asks for jumping power. I tried setting it myself once but it didn't seem to change anything.
By the way, I have a last question, when I jump, the camera doesn't return to its original position, do I have to set it manually or that's the part when a physics engine has to be used?
After reading this sentence you will realize you have wasted 5 seconds of your life
The Onslaught wrote:By the way, I have a last question, when I jump, the camera doesn't return to its original position, do I have to set it manually or that's the part when a physics engine has to be used?
Yes, you use the collision response animator on the camera as seen in tutorial 7 on the irrlicht website.
the thing is, they load the mesh, via a bsp file, I load the scene via an irr irr file (irrEdit), is there any extra step I need to do?, to get that mesh from the irr file (I hear its just an xml file)l).
Thanks in advance.
After reading this sentence you will realize you have wasted 5 seconds of your life