Views : 38
Genre: Music
Date of upload: Apr 28, 2017 ^^
Rating : 3 (2/2 LTDR)
RYD date created : 2022-01-19T10:30:29.500828Z
See in json
Top Comments of this video!! :3
Your models will come up alot better with some lighting. If you wanted to add lighting you turn on the EMF_LIGHTING flag on a per material basis. Definitely add a yellow directional light. In the old games artists would bake ambient occlusion maps and you can either use those in your light map or I prefer to use photoshop/gimp to multiply my colour texture by the ambient occlusion. To stop your scene being completely black,add some ambient light in. pSceneManager->setAmbientLight(irr::video::SColorf(0.001f, 0.001f, 0.001f, 1.0f)); But pick a colour which matches your sky box so that little orange ambient colour. Maybe scatter a few spot/point lights around. Irrlicht doesn't implement deferred lighting so you're stuck with only a few lights. I implemented deferred lighting to get around this which if you're interested you can see here https://www.youtube.com/watch?v=qNrYUlurTD0
|
To use WASD for the camera use the keyMap parameter when you create the FPS Camera.
// Make Camera
irr::SKeyMap keyMap[8];
keyMap[0].Action = irr::EKA_MOVE_FORWARD;
keyMap[0].KeyCode = irr::KEY_UP;
keyMap[1].Action = irr::EKA_MOVE_FORWARD;
keyMap[1].KeyCode = irr::KEY_KEY_W;
keyMap[2].Action = irr::EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = irr::KEY_DOWN;
keyMap[3].Action = irr::EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = irr::KEY_KEY_S;
keyMap[4].Action = irr::EKA_STRAFE_LEFT;
keyMap[4].KeyCode = irr::KEY_LEFT;
keyMap[5].Action = irr::EKA_STRAFE_LEFT;
keyMap[5].KeyCode = irr::KEY_KEY_A;
keyMap[6].Action = irr::EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = irr::KEY_RIGHT;
keyMap[7].Action = irr::EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = irr::KEY_KEY_D;
this->pCamera = pGame->getSceneManager()->addCameraSceneNodeFPS(0, 100.0f, 0.5f, -1, keyMap, 8);
|
@DodgeeSoftware
6 years ago
If you look at the http://irrlicht.sourceforge.net/docu/example007.html it has raycasting in it. Trick is to keep applying gravity until the raycast below the player shows a solid object. What I do for better accuracy is fire several rays down ward from a flat ring which is wrapped around the player. Only allow the player to 'jump' when there is solid ground under it. Granted the basic Irrlicht camera doesn't really allow for 'acceleration' so in practise its much better to create your own cameras by extending the ICameraSceneNode class or alternatively use the base camera and just have that camera follow and target the player.
|