setPosition doesn't seem to work on skybox/skydome

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
yaten
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia
Contact:

setPosition doesn't seem to work on skybox/skydome

Post by yaten »

hi sirs,

Pardon my noobishness, but I have encountered another most likely trivial problem. I was experimenting a bit with skyboxes and skydomes and I encountered a little snag and I wanted to confirm if its just my noobishness that's getting me into trouble again.

Taking the example from 12.TerrainRendering, just below the lines:

Code: Select all

	scene::ISceneNode* skybox=smgr->addSkyBoxSceneNode(
		driver->getTexture("../../media/irrlicht2_up.jpg"),
		driver->getTexture("../../media/irrlicht2_dn.jpg"),
		driver->getTexture("../../media/irrlicht2_lf.jpg"),
		driver->getTexture("../../media/irrlicht2_rt.jpg"),
		driver->getTexture("../../media/irrlicht2_ft.jpg"),
		driver->getTexture("../../media/irrlicht2_bk.jpg"));
	scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../../media/skydome.jpg"),16,8,0.95f,2.0f);

I just added this 2 lines to test the setPosition:

Code: Select all

skybox->setPosition(core::vector3df(0.f, -10000.f, 0.f));
skydome->setPosition(core::vector3df(0.f, -10000.f, 0.f));
it didn't show any warnings and errors so i'm expecting it to work, but it didn't. I already tried huge numbers (millions) but the position won't budge. Is the setPosition intended to work on skyboxes/skydomes? Again, please forgive my noobishness.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

A skybox/skydome sets its position to the active camera position every frame, it doesn't have a fixed position since you shouldn't be able to reach the sides at any time

Out of interest, why would you want to set its position anyway?
yaten
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia
Contact:

Post by yaten »

cool! it makes sense, unlike my old engine which i'm able to reach the sky border, and is awkward. thanks sir radz for the precious info ^_^

As for why I wanted to change the position, I have a sky which I wanted to drag down a bit so that my horizon is a bit lower. I guess I'd have to do that on the images, I was just wondering if I could do it on codes so that I could preserve the image. ^_^
macron12388
Posts: 126
Joined: Wed Sep 29, 2010 8:23 pm

Post by macron12388 »

I have a sky which I wanted to drag down a bit so that my horizon is a bit lower.
Moving the skyboxs' position manually seems a bit like a dirty fix. I think it would be best just to edit the skybox/skydome texture itself to get the desired effect. :)
yaten
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia
Contact:

Post by yaten »

macron12388 wrote:
I have a sky which I wanted to drag down a bit so that my horizon is a bit lower.
Moving the skyboxs' position manually seems a bit like a dirty fix. I think it would be best just to edit the skybox/skydome texture itself to get the desired effect. :)
yup, and besides, I don't have a choice, since irrlicht is making me do things the right way ^_^ one more thing why I switched engine, with irrlicht, i'm learning to be a good programmer ^_^
macron12388
Posts: 126
Joined: Wed Sep 29, 2010 8:23 pm

Post by macron12388 »

Well, just remember there's more than one way to do something. ^.^

I've taken a look at CSkyBoxSceneNode && CSkyDomeSceneNode source code and it should be fairly easy to modify them to do things you want them to do.

Also, irrlicht isn't perfect and has bugs, so it won't always make you do things the right way, sometimes it'll do things that you don't want it to do. :wink:
yaten
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia
Contact:

Post by yaten »

sir macron, thanks for the hint about CSkyBoxSceneNode, i'll keep that in mind ^_^
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can always use the texture matrix to reposition textures. However, this would probably corrupt the texture seam in the skybox. For the skydome you can alter the texture usage. Texture matrix would also work.
yaten
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia
Contact:

Post by yaten »

hybrid wrote:You can always use the texture matrix to reposition textures. However, this would probably corrupt the texture seam in the skybox. For the skydome you can alter the texture usage. Texture matrix would also work.
thanks sir hybrid, i think that's the best solution ^_^ it preserves the image and still have the flexibility of moving the texture as desired. thanks so much for the help ^_^
Post Reply