How to change cam-target AND cam-position at same moment?

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
jettitore
Posts: 11
Joined: Sat Jun 24, 2006 11:27 pm

How to change cam-target AND cam-position at same moment?

Post by jettitore »

Hi,

I have a problem, I want to change the cameratarget an -position at the same moment, but when I change one of the parameters, the scene refreshs immediately. An this results in a "bouncing" camera.

I'm using C#, which means I can not assign values to the tranformation-matrices, because they are only wrapped as read only. :(

I someone could help me, it would save me a lot of time ;) Thanks.

jettitore
Quall
Posts: 154
Joined: Mon Mar 07, 2005 10:16 pm

Post by Quall »

If you change it before you draw the scene, it will be instant. Just remember (unless Niko changed it), the scene is drawn before irrlicht makes any transformations (kind of odd).

cam->setpos(...);
cam->lookat(...);
smgr->drawall();
(generic functions used, not irr functs)

That will accomplish the exact same thing that you want. The only problem is that the scene will draw a frame before applying the position transformation. Which might be what you are actually talking about.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

So issue an updateAbsolutePosition afterwards to have the changes immediately.
jettitore
Posts: 11
Joined: Sat Jun 24, 2006 11:27 pm

Post by jettitore »

The only problem is that the scene will draw a frame before applying the position transformation. Which might be what you are actually talking about.
yes ;)
So issue an updateAbsolutePosition afterwards to have the changes immediately.
Thanks a lot!

"updateAbsolutePosition" was the solution. :) But its although strange, that I only have to call this. How does irrlicht know when to "freeze" the cam an when he has to "release" it ?

jettitore
Post Reply