Basic Camera Without Target

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.
KP84
Posts: 44
Joined: Thu Feb 24, 2011 5:08 am

Post by KP84 »

IrrlichtUserNumber| wrote:Sorry I am not at the level of excellence that you obviously must be, referring to yourself as "we".
You did ask "I like the fact that you say just...". So i do think you asked what Radikalizm said later on.

However the word 'we' is correct. At this forum and several others some, mostly leading, people are trying to keep the level of intelligence at least at low-level. Low-level as we were /all/ beginners. And low-level isn't too high I suppose.

My apologies if it is sounding harse but the general intelligence of all people is declining fast and getting faster. Please respect those who are trying to keep it up. That will benefit you too. It isn't a personal 'attack'.

That said, just :wink: do... :

Code: Select all

vector3df moveby = vector3df( 0, 10, 0 );
vector3df position = cam->getPosition();
vector3df target = cam->getPosition();

cam->setPosition( position + moveby );
cam->setTarget( target + moveby );
or

Code: Select all

// initializing
vector3df targetOffset = vector3df( 0, 0, 1 );

// update frame, set camera position
vector3df moveby = vector3df( 0, 10, 0 );
vector3df position = cam->getPosition() + moveby;

cam->setPosition( position );
cam->setTarget( position + targetOffset );
You see, it's really simple but in the flood of all knowledge in coding (c++ and irrlicht and libs and dll and whatever) even the most simple things can be a big pain and we all forget that somethimes.



Regards

Code: Select all

// if you think real code is always interresting, read this line again
IrrlichtUserNumber|
Posts: 2
Joined: Sat Jun 04, 2011 2:05 pm

Post by IrrlichtUserNumber| »

I did as Xaryl suggested...

Init
camera->bindTargetAndRotation(true);

Each frame
camera->setRotation(CameraAngle);

Just have rotation in vector and set rotation to vector each frame.

I am not sure if it is not what KP84 is more or less suggesting or why ChaiRuiPeng says it is not correct.

It seems to work fine and was the simplest solution, which is what I needed.
KP84
Posts: 44
Joined: Thu Feb 24, 2011 5:08 am

Post by KP84 »

In real-time-rendering it is always - with no exception at all - to do as less as possible.

if you put my code into a function wich is only called when pressing the move button, it will save updating the pos and target every frame. Don't know if ChaiRuiPeng meant that.

Think you could use what you are using now too in a seperate function.

Code: Select all

// if you think real code is always interresting, read this line again
Post Reply