180 degree circles ??

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
xirtamatrix
Posts: 219
Joined: Fri Feb 19, 2010 4:03 pm
Location: Estonia

180 degree circles ??

Post by xirtamatrix »

Hi,

I noticed something funny.

When rotating an object around its axis, if I setup a value of 45 it rotates 90 degrees, if I set 90 it rotates 180 and if I set 180 it rotates a full 360 degrees.

The documentation of setRotation() says:

"rotation: New rotation of the node in degrees.

So, am I doing something wrong or do we have 180 degree circles in Irrlicht??
Last edited by xirtamatrix on Thu Nov 18, 2010 7:55 pm, edited 1 time in total.
to live, is natural; to die, is not!
speedy15453
Posts: 22
Joined: Tue Nov 09, 2010 7:03 pm
Location: ohiio

I'm new, 99% of my knowledgle is rotation 1% is fine dining

Post by speedy15453 »

Post your code for the rotations.
Only after disaster can we be resurrected.
xirtamatrix
Posts: 219
Joined: Fri Feb 19, 2010 4:03 pm
Location: Estonia

Post by xirtamatrix »

ok, sorry, normal nodes actually rotate correctly.

The said behaviour is only in the case when node is ELT_DIRECTIONAL and rotation is being applied to "direction". Still, I dont see why a directional light should be completing a full-circle in 180 degrees.

Can anyone just test it and confirm please?

No special code required, just do node->setRotation() on a directional light.
to live, is natural; to die, is not!
lazerblade
Posts: 194
Joined: Thu Mar 18, 2010 3:31 am
Contact:

Post by lazerblade »

I haven't been able to figure out exactly how Irrlicht handles directional lights. I think when you set rotation, you're actually setting a directional vector. Like 'light->setRotation(0,0,1)' would be pointing down the Z axis. Or it could be that you're actually setting rotation. I dunno.

It might help if we could see how you are rotating it, posting your code wouldn't hurt anyway. We could see it fresh and maybe notice something new.
LazerBlade

When your mind is racing, make sure it's not racing in a circle.

3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
xirtamatrix
Posts: 219
Joined: Fri Feb 19, 2010 4:03 pm
Location: Estonia

Post by xirtamatrix »

lazerblade wrote: I think when you set rotation, you're actually setting a directional vector. Like 'light->setRotation(0,0,1)' would be pointing down the Z axis.
The docs mention the following:
If the light type is directional or spot, the direction of the light source is defined by the rotation of the scene node (assuming (0,0,1) as the local direction of the light).

So what does the 1 in (0,0,1) stand for? Is it a directional vector or is it an angle in degrees?

If its a directional vector, does it mean 1 would be pointing to positive Z and -1 to negeative Z? That dont seem to be the case.

Can anyone with experience of it please explain?


lazerblade wrote:It might help if we could see how you are rotating it, posting your code wouldn't hurt anyway.
There really isn't anything to show but ok, I could scribble down a few lines right here:

Code: Select all

ILightSceneNode *sun = smgr->addLightSceneNode(0, .....);
sun->setLightType(ELT_DIRECTIONAL);
//Initially, the light would be pointing Z-positive, i.e. due North.
//now rotate the light

Code: Select all

sun->setRotation(vector3df(0,45,0)); //rotate on Y axis 
//now the light is rotated 90 degrees and actually pointing due East.
//rotate again

Code: Select all

sun->setRotation(vector3df(0,90,0)); //rotate on Y axis 
// now the light has been rotated a full 180 degrees and pointing due South.

and so on...
to live, is natural; to die, is not!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, as the docs say, it's the direction (0,0,1). And this means that the light shines down the z-axis (into the screen) by default. And rotation of the node is applied to that vector in order to get the actual light direction.
xirtamatrix
Posts: 219
Joined: Fri Feb 19, 2010 4:03 pm
Location: Estonia

Post by xirtamatrix »

hybrid wrote:And rotation of the node is applied to that vector in order to get the actual light direction.
Thats all well, but it doesn't explain why does the light rotate 90 degree with a value of 45 and 180 degree with a value of 90 and 360 degree with a value of 180.

It appears the value provided is getting doubled-up somehwere. I'd look at the SceneLightNode later and see if I find something.
to live, is natural; to die, is not!
Post Reply