Rotating screen

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
no_response
Posts: 26
Joined: Fri Aug 20, 2010 11:07 am
Location: Bulgaria

Rotating screen

Post 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.
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

Rotate camera 8))))
Do you like VODKA???
Image
Image
no_response
Posts: 26
Joined: Fri Aug 20, 2010 11:07 am
Location: Bulgaria

Post by no_response »

camera rotation doesn't work when drawing images, right?
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

ok

Post 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

 */

no_response
Posts: 26
Joined: Fri Aug 20, 2010 11:07 am
Location: Bulgaria

Post by no_response »

I still fail to see how modifing a camera can affect drawn images....
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Post 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.
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post 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.
Never take advice from someone who likes to give advice, so take my advice and don't take it.
no_response
Posts: 26
Joined: Fri Aug 20, 2010 11:07 am
Location: Bulgaria

Post 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?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

try camera->bindTargetAndRotation(true); !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
no_response
Posts: 26
Joined: Fri Aug 20, 2010 11:07 am
Location: Bulgaria

Post 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.
Post Reply