jinko
2007年09月20日 20:33
//===============================================
// [Balloon.lsl]
// Floating Balloon
// ver 1.0 Sep 20, 2007 by Jinko Spitteler
//===============================================
// Ref http://wiki.secondlife.com/wiki/LlSetBuoyancy
float fBalloonLife = 300.0; //[sec]
init () {
llSetPrimitiveParams([PRIM_PHYSICS, TRUE]);
llSetBuoyancy(1.05);
llSetTimerEvent(fBalloonLife);
}
ending () {
llOwnerSay("Bang!!");
llSetTimerEvent(FALSE);
llDie();
}
default {
state_entry () {
init();
}
touch_start (integer num_detected) {
ending();
}
timer () {
ending();
}
}
//===============================================
// [Balloon.lsl]
// Floating Balloon Following AV
// ver 1.1 Sep 20, 2007 by Jinko Spitteler
//===============================================
// Ref http://wiki.secondlife.com/wiki/LlSetBuoyancy
// Ref http://kappa.slmame.com/e19525.html
// Ref http://sabro.slmame.com/e28777.html
key keyOwner;
float fSensorRange = 30.0; //[m]
float fSensorInterval = 2.0; //[sec]
float fTargetRange = 0.1; //[m]
vector vecTargetOffset = ;
float fBalloonLife = 300.0; //[sec]
init () {
llSetPrimitiveParams([PRIM_PHYSICS, FALSE]);
llSetBuoyancy(1.0);
keyOwner = llGetOwner();
llSetTimerEvent(fBalloonLife);
llSensorRepeat("", keyOwner, AGENT, fSensorRange, PI * 2, fSensorInterval);
}
move(vector vecTargetPos) {
vector vecCurrentPos = llGetPos();
llSetPrimitiveParams([PRIM_PHYSICS, TRUE]);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
llMoveToTarget(vecTargetPos, 1.0);
}
ending () {
llOwnerSay("Ban!!");
llSetTimerEvent(FALSE);
llDie();
}
//-------------------------------------------------------------
// Default State
//-------------------------------------------------------------
default {
state_entry () {
init();
}
sensor (integer num_detected) {
move(llDetectedPos(0) + vecTargetOffset);
}
touch_start (integer num_detected) {
ending();
}
timer () {
ending();
}
}