| jo4545 2005-04-05, 12:15 pm |
| hi, i have a chair in my world that i want to move around in two directions so that it can move right and left and forwards and backwords along the gorund. (i think this is x and z) anyway, i have code which can move the object in one direction backwards and forwards but not the other direction.. how do i change it so it moves both ways?
my code:
DEF PS PlaneSensor {}
]
}
DEF slider_s Script {
eventIn SFVec3f PS_position
field SFVec3f moveSlider 0 0 0
eventOut SFVec3f shift
url "vrmlscript:
function PS_position(value) {
if (value[0] > 5) value[0] = 5;
if (value[0] < -5) value[0] = -5;
moveSlider[0] = value[0];
shift = moveSlider;
}
"
}
]
}
ROUTE PS.translation_changed TO slider_s.PS_position
ROUTE slider_s.shift TO slider.set_translation
please help!! |