Sliding double doors
This is a set of double doors that slides when one of them is touched. Put the controller in the ROOT PRIM, this essentially relays the fact that it has been touched to both doors at the same time so they should open at the same time. Make one door that has a positive open_by amount and another that has a negative amount. Can also change the direction of opening by putting a different axis in.
//controller for the sliding doors. //olly butters 19/1/08 //essentially just relays a linked message. default { state_entry() { llSay(0, "Hello, Avatar!"); } link_message(integer source, integer num, string str, key id) { llMessageLinked(LINK_ALL_OTHERS,1,"",""); } }
//The starting pos will have to be hardwired in incase the sim crashes and it resets with the doors open. vector starting_position; vector open_by = <0.0, 2.0, 0.0>; //amount and axis to open by. default { state_entry() { starting_position = llGetLocalPos(); //quick hack, needs real coords. llSetPos(starting_position); state closed; } } state closed { state_entry() { //llSay(0, "I am closed"); llSetPos(starting_position); //state waiting_for_message; } //when touched send a message to the controller. touch_start(integer temp) { llMessageLinked(LINK_ROOT,1,"",""); } //when contoller tells me to i open. link_message(integer source, integer num, string str, key id) { state open; } } state open { //open, sleep, close. state_entry() { //llSay(0, "I am open"); vector open_position = starting_position+open_by; llSetPos(open_position); llSleep(5); llSetPos(starting_position); state closed; } }