camera rotation problem

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.
kkray
Posts: 4
Joined: Sun Nov 04, 2007 10:04 am
Location: kaliningrad, russia
Contact:

camera rotation problem

Post by kkray »

i want to use png-texture with transparent and semi-transparent zone for billboard and cube nodes?
if i use only:
video::ITexture *frame0=driver->getTexture("media/car.png");
billboard->setColor(video::SColor(255,255,255,255),video::SColor(255,255,255,255));
billboard->setMaterialFlag(video::EMF_LIGHTING, false);
billboard->setMaterialTexture(0,frame0);

then trasparent zone drawed by black color =(

what can i do for solve this "problem" ?
Last edited by kkray on Sun Nov 04, 2007 12:39 pm, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to change the material type to EMT_TRANSPARENT_ALPHA_CHANNEL
kkray
Posts: 4
Joined: Sun Nov 04, 2007 10:04 am
Location: kaliningrad, russia
Contact:

Post by kkray »

thanks!!

maybe you now, how i can rotate (not animate) camera around it self (if player in game bend his head on side)?

i use this code:
scene::ICameraSceneNode *camera = smgr->addCameraSceneNode(smgr->getRootSceneNode(),core::vector3df(100,100,100),core::vector3df(0,0,0),-1);
camera->setRotation(core::vector3df(45,45,45));

but result of last string working is equal to result of this string working:
camera->setRotation(core::vector3df(0,0,0));

why?
WarShattrith
Posts: 6
Joined: Wed Oct 17, 2007 5:07 pm

Post by WarShattrith »

Same thing for me !
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Because camera has separate rotation and lookat target. You have to change the looking direction of the camera. Read the API and check the tutorials.
kkray
Posts: 4
Joined: Sun Nov 04, 2007 10:04 am
Location: kaliningrad, russia
Contact:

Post by kkray »

thanks!
sepi
Posts: 1
Joined: Mon Nov 05, 2007 9:30 pm

Post by sepi »

Hi irr-comunity,I have same kind of problem.
I try to flip camera, but then I flip it, my mouse become inverted. In my opinion it is not right, because if camera is like my eys and if I stand on my head my left side is still on my left and my rightside on my right.

Here is code:

Code: Select all

scene::ICameraSceneNode* camera = 
		smgr->addCameraSceneNodeFPS();
camera->setUpVector(core::vector3df(0,-1,0));
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi. Sepi.

I've asked for this some time ago. But the mouse controller is not oriented with the UPVector of the camera.

That is a feature that will need to be implemented. For some things it's good that the mouse is not totally following the axis of the camera (head tilt) But if you would like to walk in a ceiling or walls, there need to be a new camera controller that support this (remapping the X-Y mouse coordinate plane into the X,Y,Z of the world.)

At the moment, if you really want to do this, you will have to use the standard camera and create your own controller.

I know that Bitplane is working on camera controller but don't know if we will able to do this. Since my current skills for C++ and math are not good enough, I'm still waiting.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

i'm not sure, i'm experiencing the same problem with u. first time in irrlicht i'm confused with the coordinate system, because i can rotate the camera all the way. and in my case i use blender to export my models and when loaded. i got to rotate the camera in order to make my model in the correct perspective. when i use the FPS camera i realize that what i did is wrong because when move i got wrong direction to move. so try not to transform the camera but rotate the model. hope this help :oops:
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Yes, I tought about that idea. Rotate the environnement instead of the player. It should work. But you will have to build(parent) you scene based on a specific node and rotate that node (so all objects will positionned exacltly the same)

Irrlicht has a global coordinate system. Software like Blender can use multiples coordinate system.

Global - X,Y,Z for the entire world
(Depending on the system, for Lightwave for example, X is for the horizontal axis, Y is for the vertical axis and Z is for the depth axis)

Local - X,Y,Z aligned on the current object(node) aligment.
Quick and simple example: Camera is "parented" to a box and looking 45 degree. The box is rotated 45 degree, so in local axis the camera is at 45 degree but for the global axis it's 90 degree.

Not sure IRRlicht as function to convert for a coordinate system to another.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Irrlicht also uses relative positions for child scene nodes.
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Post by kornwaretm »

relative position? did u mean if i transform(rot,scale,trans) the node before attach to parent will not affect the parent?
humbrol
Posts: 83
Joined: Sun Nov 18, 2007 8:22 pm

Post by humbrol »

Code: Select all

188 C:\irrlicht\main.cpp 'class irr::scene::ISceneNode' has no member named 'setUpVector' 
when i run

Code: Select all

cam->setUpVector(core::vector3df(0,-1,0));
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

188 C:\irrlicht\main.cpp 'class irr::scene::ISceneNode' has no member named 'setUpVector'
That is because the type of cam is ISceneNode*, but it needs to be ICameraSceneNode*. The code posted by sepi is more like what you need.
relative position? did u mean if i transform(rot,scale,trans) the node before attach to parent will not affect the parent?
The position of the child never has any effect on the parent. The position of the parent will affect the position of the child though. It doesn't matter when you change the position though, the effect is the same. The position of the child is always relative to the parent.

Travis
humbrol
Posts: 83
Joined: Sun Nov 18, 2007 8:22 pm

Post by humbrol »

do you have a link, not pulling sepi up under authors on search
Post Reply