theres no movement functions, i'll probably just make it inheret from the FPS camera and
then remove the FPSness from it
anyway here it is
#define SCREENW and #define SCREENH..
Code: Select all
class ICameraSceneNodeFS : public ICameraSceneNode {
protected:
position2d<s32> mousePos, zero;
IAnimatedMeshSceneNode *plane;
public:
ICameraSceneNodeFS(IAnimatedMeshSceneNode *p) {
plane = p;
mousePos = position2d<s32>((s32)0,(s32)0);
zero = position2d<s32>((s32)(SCREENW/2),(s32)(SCREENH/2));
}
void update(IrrlichtDevice *dv) {
mousePos = dv->getCursorControl()->getPosition();
if(mousePos.X > zero.X) { // moved to the right
// move camera
vector3df p = getRotation();
p.Y += 1;
setRotation(p);
// tilt plane
vector3df z = plane->getRotation();
z.Z += 1;
plane->setRotation(z);
}
if(mousePos.X < zero.X) { // moved to the left
// move camera
vector3df p = getRotation();
p.Y -= 1;
setRotation(p);
// tilt plane
vector3df z =plane-> getRotation();
z.Z -= 1;
plane->setRotation(z);
}
if(mousePos.Y > zero.Y) { // moved down
vector3df p = getRotation();
p.X += 1;
setRotation(p);
}
if(mousePos.Y < zero.Y) { // moved up
vector3df p = getRotation();
p.X -= 1;
setRotation(p);
}
dv->getCursorControl()->setPosition(position2d<s32>((SCREENW/2),(SCREENH/2)));
}
};i just threw it together from boredome.. hope it'll be of some use to someone!
-dudMaN
EDIT: hey, vitek,
[/quote]i just threw it together from boredome.. hope it'll be of some use to someone!