I’m currently involved in Action-RPG game developing (see french "H.E.L.P." project). A few weeks ago, I was looking for a smooth and mixed first and third person camera (like Guild Wars camera). So, I developed my own one. As the first result is encouraging, I would like to share it with Irrlicht users.
The class CCameraRPGSceneNode handles both player and camera moves and rotations. It receives mouse and keyboard events from device. CCameraRPGSceneNode does NOT handle player animation (you have to make your own class, inherited from CCameraRPGSceneNode).
Actually, this camera is a bit complex in its implementation (nearly 1.000 line of code) and its settings. But, using this camera remains really simple.
Test video (in-game video made by jclins, mirrored by cubicool) using this camera (version 6).
LINKS >>>> VIDEO (RapidShare) | VIDEO (Mirror1) | VIDEO (Mirror2) <<<< LINKS
Test program screen :
Recent update (06/11/2006) :
* Minor change.
* Tested with Irrlicht 1.1.
Previous update (23/02/2006) :
* Add a RUN control : default running key is SHIFT and default speed multiplier is 2.0 (kickBack's demand).
* SHIFT and CONTROL keys are supported (XML user defined key map).
Previous update (17/02/2006) :
* Add a timer divider for high end computers (fixed by jclins) [the default value is 1, 64-bit computer use a value of 65536 (2^16)]
* Improved first-to-third camera transition when colliding.
* Smoother camera collision animator.
Previous update (14/02/2006) :
* Key map is loaded from XML file.
Previous update (11/02/2006) :
* Rotation and move speeds decrease when reaching target angle/position (overall smoother behavior).
Previous update (31/01/2006) :
* Camera post render its children.
* Node rotation is partially updated.
Previous update (24/01/2006) :
* Camera is now a scene node, that registers it self into Irrlicht scene manager and offers camera scene node interface.
* Camera uses default settings (from source code) and user-defined settings (from XML configuration file : see "cam.xml" into release archive).
* Camera may be inherited to add "physic" into player moves (override virtual void player_physic_animator(...) method) (asked by Sudi).
* Added custom behavior (a few flags into camera settings) according needforhint and Niels demands.
* Player is now transparent when camera is passing from 3rd to 1st person and vice-versa.
CCameraRPGSceneNode initialisation :
Code: Select all
irr::scene::CCameraRPGSceneNode* cam =
new irr::scene::CCameraRPGSceneNode(player,smgr,1,device,selector,"cam.xml");
smgr->setActiveCamera( cam );
cam->drop();
The Zip archive contains the source code of CCameraRPGSceneNode(.hpp/.cpp), Irrlicht 0.14 CCameraSceneNode (.h/.cpp), and a main test program where CCameraRPGSceneNode is instanced. There is also a code::block project file (with my own directory settings, you have to change according your Irrlicht install).
Irrlicht has changed (SVN) : now OnEvent has const& argument. Change my camera OnEvent callback.
Current release (Irrlicht 1.1) :
LINK >>>>PlayerCameraRPGV8.zip<<<< LINK
Deprecated release (do not use) :
LINK >>>>PlayerCameraRPGV7.zip<<<< LINK
LINK >>>>PlayerCameraRPGV6.zip<<<< LINK
LINK >>>>PlayerCameraRPGV5.zip<<<< LINK
LINK >>>>PlayerCameraRPGV4.zip<<<< LINK
LINK >>>>PlayerCameraRPGV3.zip<<<< LINK
LINK >>>>PlayerCameraRPGV2.zip<<<< LINK
LINK >>>>PlayerCameraRPGV1.zip<<<< LINK
Install release :
Copy "100. Player Camera RPG" folder into the "irrlicht/examples" directory. Run "Irrlicht.exe" to test the camera.
Do not forget to update media and cam.xml directories into source code.
There is a Visual C++ 2005 Express project inside release. Adjust its properties to suit your software environment (paths/...).
List of controls :
Z : forward
S : backward
Q : turn left (strafe left in freelook mode)
D : turn right( strafe right in freelook mode)
A : strafe left
E : strafe right
Mouse : GUI cursor or freelook
Right Mouse Button : freelook toogle
Mouse Wheel : increase/decrease camera distance and toggle 1st / 3rd party camera mode.
Key map is for AZERTY keyboard. That may be changed into the source code and XML file.
Next update :
* A detailed documentation.
* More accurate comments into source code.
* Incorporation into Irrlicht SDK (?).
Let me know what you think of the this camera. I offer free support and on-demand new features !
Please, send me screenshots and short videos of your game using this camera !
Xterm-In’Hate.