Page 1 of 1

Rotating screen

Posted: Fri Aug 20, 2010 11:16 am
by no_response
Hi all,
I've been reading the forum for a while now, but I can't find a solution...

I'm trying to rotate the whole screen. I need to rotate it around a point, that is out of the screen.
I'm building 2d graphics with images.
I know it has something to do with matrix4, ETS_VIEW and stuff, but I can't get it work.

My last and most logic attempt was like

Code: Select all

matr = driver->getTransform(video::ETS_VIEW);
matr.setRotationDegrees(core::vector3df(0, 0, time%360)); 
driver->setTransform(video::ETS_VIEW , matr);
Some help would be appreciated.

Posted: Fri Aug 20, 2010 11:28 am
by Bear_130278
Rotate camera 8))))

Posted: Fri Aug 20, 2010 11:36 am
by no_response
camera rotation doesn't work when drawing images, right?

ok

Posted: Fri Aug 20, 2010 1:19 pm
by Dareltibus
assuming you know basic trigonometrics.

Code: Select all


irr::scene::ICameraSceneNode *mycamera=
    addCameraSceneNode(0, vector3df(x,y,z)), vector3df(tx,ty,tz));

// x,y,z are camera position
// tx,ty,tz is target point (lookinAt)

//now

mycamera ->setUpVector(vector3df(a,b,c))

/*is the up vector. so you must imagine a man holding a camera in his hands. It has the camera in one point looking at another point. but. Where is the head of the men heading (lol)?

This is the up vector. You have to update a,b,c values in time using trigonometric calculations.
Another way is for example setting a point rotating around your camera. Then you get the vector3df that is the position of the point after rotation. Then

upvector = (Pointpos-camerapos).normalize();

you have your up vector looking at this point... Maybe looking your scene rotaring will get you sick O_O

 */


Posted: Fri Aug 20, 2010 1:32 pm
by no_response
I still fail to see how modifing a camera can affect drawn images....

Posted: Fri Aug 20, 2010 1:58 pm
by Dareltibus
oh sorry i misunderstood that you was referring to pictures..

Idk know how to rotate images into the GUI. you can always create your own scene node taking inspiration from billboad scene node but making it rotatings and not staying up in one direction..

And have also to do set PROJECTIVE wiew instead of PErspective. but in this way this will be 3D masked as 2D.

Posted: Fri Aug 20, 2010 1:59 pm
by Bate
The camera doesn't affect images, gui elements etc.

So, if you want everything rotated you could probably render to a render target texture, rotate the texture and draw it to the screen.

Posted: Sun Aug 22, 2010 3:53 pm
by no_response
hi again....

I fail to rotate the camera, help ?

what I do is I create a node at 0, 0, 0
create a camera at 0, 200, 0
set the camera's target to 0, 0, 0

but when i try to rotate the camera like (0, angle, 0) it doesn't work.

what am I doing wrong?

Posted: Sun Aug 22, 2010 4:30 pm
by Acki
try camera->bindTargetAndRotation(true); !!!

Posted: Sun Aug 22, 2010 4:34 pm
by no_response
I did, and when I bind them when I try to rotate the camera my node just disappears.

It seems I will have to use the upvector.