can you find the jittering ?...

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
muckelzwerg
Posts: 16
Joined: Wed May 04, 2005 11:38 am

can you find the jittering ?...

Post by muckelzwerg »

A while ago I tried to set up a primitive 3rdperson camera using the FPS camera.
I encountered a few problems and went for a different solution,
but that thing still bugs me.
I'm merely getting the cameras orientation an move it to look
at the desired target.
And somehow this results in massive jittering.
So I tried to update the positions, but that didn't help.
Without any position updates the image is jittery and seems to suffer from
the "transformation update after draw"-problem.
Using updataAbsolutePosition on the camera results in a clean displayed node. But it also results in seeing a "wrong frame" for an instant, while rotating the camera.Its not the last frame, its more like rotated around 90 degres.
The other position updates have no effect.
So can somebody tell me where the mistake is ?
Is it sth. I'm missing about the camera or the target node ?

Code: Select all

f32 camera_distance = 50.f;
void update_camera()
{

	//my_target_node->updateAbsolutePosition();
	//my_camera->updateAbsolutePosition();

	core::vector3df temp = my_camera->getTarget() - my_camera->getPosition();
	
	temp.normalize();
	my_camera->setPosition( (my_target_node->getPosition()) - temp*camera_distance );
	
	
	//my_target_node->updateAbsolutePosition();
	//my_camera->updateAbsolutePosition();
}
sourada
Posts: 5
Joined: Mon May 09, 2005 8:24 pm

Post by sourada »

Have you tried setting the target as well as the position of the camera?

For my camera solution, I actually set up some dummy nodes in a scenegraph:
scene::ISceneNode *graph = smgr->addEmptySceneNode();
scene::ISceneNode *camerapos = smgr->addEmptySceneNode(graph);
scene::ISceneNode *cameralookat = smgr->addEmptySceneNode(graph);
scene::ISceneNode *cameraup = smgr->addEmptySceneNode(graph);
camerapos->setPosition(core::vector3df(0.0f, -5.2f, 13.3f));
cameralookat->setPosition(core::vector3df(0.0f, -5.2f, 1000.0f));
cameraup->setPosition(core::vector3df(0.0f, 1000.0f, 13.3f));
// more stuff added to 'graph'

Then when I move the 'graph' node (driven by a physics engine):
Physics.GetBodyPosRot(0, pos, rot);
graph->setPosition(pos);
graph->setRotation(rot);

That also moves my dummy nodes. Then I set all the camera DOFs and updateAbsolutePosition:
camera->setPosition(camerapos->getAbsolutePosition());
camera->setTarget(cameralookat->getAbsolutePosition());
camera->setUpVector(cameraup->getAbsolutePosition() - camerapos->getAbsolutePosition());
camera->updateAbsolutePosition();

I won't claim it's a brilliant solution, but it does get me precisely what I want visually.

I've had a few jitter problems related to converting the rotation from the physics engine to Euler angles for Irrlicht, because of singularities, etc. You might want to look at that possibility too.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Re: can you find the jittering ?...

Post by Emil_halim »

muckelzwerg wrote:A while ago I tried to set up a primitive 3rdperson camera using the FPS camera.
I encountered a few problems and went for a different solution,
but that thing still bugs me.
I'm merely getting the cameras orientation an move it to look
at the desired target.
i was having the same problem, and i want absolute rotation for my camera
but because irrlicht calculate the target point evry time when render.
so that i decided to create my own camera and put a lookat function sapartely,so
when i need it i will call it and now i can rotate and move the camera without
the restrict traget point.

here is a link for my camera
http://www.irrforge.org/index.php/Panor ... h_Irrlicht

or

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=6628
muckelzwerg
Posts: 16
Joined: Wed May 04, 2005 11:38 am

Post by muckelzwerg »

Great, third time, I answer this thread, and it just gets lost
somewhere.

@ sourada :
I implemented a externel camera very similarto yours.
It works fine , but since I used the normal cameraI have to map
the mouse movements to the rotation.
Maybe Im just stupid, but I cant get it done smoothly.
How did you solve that ?
sourada
Posts: 5
Joined: Mon May 09, 2005 8:24 pm

Post by sourada »

Ooops, didn't see that there was a question for me here.

I don't directly control the camera with the mouse, I actually just control the steering in the vehicle physics model. The physics model then calculates the position and orientation of the chassis, which I then set on my 'graph' ISceneNode.

So, sorry to say I can't help you much with that question.
Post Reply