This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > April 2005 > plane sensor





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 plane sensor
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!!
Sponsored Links


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