camera rotation problem (model post fixed)

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
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

camera rotation problem (model post fixed)

Post by Strong99 »

I tried to rotate a model, with the rotate.Y everythings fine, but when i use the X rotation after -68 the model mirrors himself instead of rotating farther
Last edited by Strong99 on Sat Mar 17, 2007 4:51 pm, edited 3 times in total.
c.h.r.i.s
Posts: 41
Joined: Mon Jan 22, 2007 8:38 pm

Post by c.h.r.i.s »

Hi! can you post the code in here?
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

Code: Select all


irr::core::vector3df rot = node->getRotation();
rot.X -= 1;
node->setRotation(rot);

smgr->beginScene(true,true,video::SColor(255,255,255,255));
   Device->getSceneManager()->drawAll();
smgr->endScene()

everythings go well until X < -70 or X > 190
i use an X model
c.h.r.i.s
Posts: 41
Joined: Mon Jan 22, 2007 8:38 pm

Post by c.h.r.i.s »

Hi! I think "X < -70 or X > 190" is not the problem. All works fine if i try it. (x<-5000 and x > 5000).

I think the problem is another. Is there another function that will change properties of "node"?

And what do you mean with "mirrors himself"? Do you see the model twice?
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

no, the model looks like it rotate 90 on the Y but its actualy mirrord

no, nothing calls him, i'm using irr 1.2
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

even if i parent him on a FPS camera it hapens, when i go under X < -70, the model mirrors but the came still rotate ok.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

I found the real problem. The camera was attachd to it annd when the camera came under -70 it hit the max angle and the camera inverted instead of model. But how to fix?

because the the camera has a target and don't follow its models rotation
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

I need the camera to rotate with the object instead using setTarget, Settarget woun't follow and because of that he takes the shorest route,

i want this:
the red line indicates the upper border of the scene, the upper image strip shows that the camera moves along and the upper corner gets the lower than the bottom of the screen so the camera rotate with me.

But the second example happens. (bottom image strip);

the upper border of the scene stays the upper, it won't rotate with me

Image
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You need to set the up vector if you want the camera to go upside down.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

i noticed that it occurse at rotation X > 55 and rot X < 125,

so i did

Code: Select all

if (rot.X > 55 && rot < 125)
   camera->setUpvector(0.0f,-1.0f,0.0f);
it changes on the good values but nothing change ( i did a check)

[EDIT]
Ah, it resets himself i need to set it every time and then setTarget
thanks
Post Reply