Code: Select all
//! Class Player -------------------------------------------
class CPlayer
{
private:
// KeyArrays
SKeyMap keyMap[5];
keyMap[0].Action=EKA_MOVE_FORWARD; keyMap[0].KeyCode=KEY_KEY_W;
keyMap[1].Action=EKA_MOVE_BACKWARD; keyMap[1].KeyCode=KEY_KEY_S;
keyMap[2].Action=EKA_STRAFE_LEFT; keyMap[2].KeyCode=KEY_KEY_A;
keyMap[3].Action=EKA_STRAFE_RIGHT; keyMap[3].KeyCode=KEY_KEY_D;
keyMap[4].Action=EKA_JUMP_UP; keyMap[4].KeyCode=KEY_SPACE;
public:
// Node Create
scene::ICameraSceneNode* Node;
scene::ISceneNodeAnimator* Anim;
// Object Create
CPlayer(unsigned _id,string _name,core::vector3df _pos,float _rotspd,float _movspd,float _jumpspd)
{
Node=smgr->addCameraSceneNodeFPS(0,_rotspd,_movspd,_id,keyMap,5,true,_jumpspd);
Node->setPosition(_pos);
Node->setName(_name.c_str());
}
// Add Collision to Scene
int addCollision(scene::ITriangleSelector* _world,core::vector3df _elipse,core::vector3df _elipse2,float _gravity)
{
Anim=smgr->createCollisionResponseAnimator(_world,Node,
_elipse,
core::vector3df(0,_gravity,0),
_elipse2);
Node->addAnimator(Anim);
Anim->drop();
}
};
Thanks for any helps ;p