This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > April 2005 > background switching





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author background switching
jo4545

2005-04-23, 2:30 pm

hi, in my vrml scene i have abutton that makes it go from night to day. this uses javascript to turn lights off and also to change the background sky and ground colours from green and blue to black. Everything else works apart from this background change. my code should work but i dont know why it doesnt there are no errors

DEF Illuminator Script {
eventIn SFBool touched1
field SFBool lit1 FALSE
eventOut SFBool light_changed
eventOut SFBool light_changed2
eventOut SFColor emissive
eventOut MFColor backsky
eventOut MFColor backgro

url [ "java script:
function touched1(value, timestamp) {
if (value) {
if (lit1) {
lit1 = false;
light_changed = false;
light_changed2 = true
emissive = new SFColor(0,0,0);
backgro = new MFColor(0.2784,0.5137,0.1647);
backsky = new MFColor(0.7137,0.8314,0.9216);
} else {
lit1 = true;
light_changed = true;
light_changed2 = false
emissive = new SFColor(0.3,0.3,0.3);
backgro = new MFColor(0,0,0);
backsky = new MFColor(0,0,0);
}
}
}



" ]



ROUTE daynight.isActive TO Illuminator.touched1
ROUTE Illuminator.light_changed TO Omni01.set_on

ROUTE Illuminator.light_changed TO Omni02.set_on


ROUTE Illuminator.light_changed TO Omni03.set_on


ROUTE Illuminator.light_changed TO Omni04.set_on


ROUTE Illuminator.light_changed2 TO day1.set_on


ROUTE Illuminator.light_changed2 TO day2.set_on

ROUTE Illuminator.emissive TO mat.emissiveColor


ROUTE Illuminator.backgro TO background1.groundColor

ROUTE Illuminator.backsky TO background1.skyColor

}

so could someone just have a look at the background bits for me. if not sure about working with MFColors so maybe that part is wrong.
thanks jo x
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews