camera rotation problems.... it wont stay still

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
cheesyPoof
Posts: 10
Joined: Mon Oct 10, 2005 4:38 am

camera rotation problems.... it wont stay still

Post by cheesyPoof »

hey all. i'm fairly new to irrlicht and have a question regarding camera rotation.

i am using an FPS camera, and when i run my app, the camera continually rotates upward, and will not stay still.

here is the code for my Camera class:

Code: Select all


#include "Camera.hh"

#include "IrrManager.hh"

using namespace irr;

    
Camera::Camera()
{
  scene::ISceneManager* smgr = IrrManager::get()->getSceneManager();
  
  node = smgr->addCameraSceneNodeFPS( 0, 100.0, 500.0 );
  
  node->setParent( smgr->getRootSceneNode() );
  node->setFarValue( 12000.0 );
  node->setUpVector( core::vector3df( 0.0, 1.0, 0.0 ) );
}

void Camera::setPosition( core::vector3df position )
{
  node->setPosition( position );
}
 
void Camera::setTarget( core::vector3df target )
{
  node->setTarget( target );
}
    
void Camera::setParent( scene::ISceneNode* parent )
{
  node->setParent( parent );
}

core::vector3df Camera::getPosition()
{
  return node->getPosition();
}

core::vector3df Camera::getTarget()
{
  return node->getTarget();
}

scene::ISceneNode* Camera::getParent()
{
  return node->getParent();
}

scene::ICameraSceneNode* Camera::getCameraNode()
{
  return node;
}
and here is how it is used in my World class:

Code: Select all

  // Add camera
  camera = new Camera();
  camera->setPosition( core::vector3df( 1900*2, 255*2, 3700*2 ) );
  camera->setTarget( core::vector3df( 2397*2, 343*2, 2700*2 ) );
for reference, i am building my code on fedora core 4, using g++ compiler, and irrlicht version 0.12.0.

has anyone seen this problem?
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

I had this problem when I didn't realise that the camera's target co-ordinates are in world co-ordinates, not local. As the camera moves, it turns so that it is facing the same global location.
cheesyPoof
Posts: 10
Joined: Mon Oct 10, 2005 4:38 am

Post by cheesyPoof »

i tried it without setting a target vector, same problem.
also, it happens if the camera is moving or standing still.

when i build and run the example 12, i don't see this problem.

could it be the way i am storing the camera node object?

i am generally a java programmer, so subtle c++ issues sometimes go over my head.
cheesyPoof
Posts: 10
Joined: Mon Oct 10, 2005 4:38 am

Post by cheesyPoof »

i played around with it some more, and found that the problem is somehow tied to the setting for resolution.

when i set up the irrlicht device object, as such, there is no problem.

Code: Select all

  device = createDevice( driverType,
			 core::dimension2d<s32>( 1024, 768 ) );
however, when i use "1280, 800" as a resolution, the camera continually rotates upward no matter what.

i have tested this mith many resolutions, only 1280, 800 seems to be problematic.

i use this resolution because i am developing on a compaq laptop with a widescreen.

does anyone know why the resolution setting would affect the camera's rotational behaivor?

note: i see this problem as well when i change the resolution in the example 12 code.
Guest

Post by Guest »

this is weird because in my own stuff it has never happened, but I checked out the irrlicht visual editor yesterday and that was doing just what you said - and this was also on a laptop (1280x800) but of course it wasn't a fullscreen app or anything but a window in a gui tool.
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

yes, i can confirm that. Post irr 0.9 this happens (with win resolution 6*800) if irr viewport y >570
i would suspect that theres other limits for other win resolutions??
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
cheesyPoof
Posts: 10
Joined: Mon Oct 10, 2005 4:38 am

Post by cheesyPoof »

thanx for verifying this guys.

so does this mean that i can't run anything at fullscreen on my laptop, without this happening?
Post Reply