And this is the script that makes my avatar move when the object moves when attached.
---
float d=0.25; //radius / distance we bob up and down float step = 0.2; // distance to move each step. 0.1 would make it bob slow, 0.8 would make it bob faster, ect vector pos; float x=0; vector bobthrust;
default
{ state_entry()
{ llSetBuoyancy(1.0); // this turns on buoyancy llSetTimerEvent(0.5); // this sets the timer, the timer makes up bob up and down. llTargetOmega(<0,0,0.5>,1,1); // this part makes it spin (uses targetomega so it's client-side) pos=llGetPos(); // cache our position (note that this will need to be done again if you move it) llSetStatus(STATUS_PHANTOM , TRUE); // become phantom llSetStatus(STATUS_PHYSICS , TRUE); // become physical (for smooth bobbing motion) } timer() // this part bobs up and down { x+=step; // add our step in bobthrust = <0,0,llCos(x)*d>; // use cosine to figure new position llMoveToTarget(pos+bobthrust,0.8); // move to that new position }
}
---
Unfortunately the first script I posted makes it rotate while attached, instead of moving up and down.