注:所有内容摘抄自 http://www.ibm.com/developerworks/cn/edu/r-dw-r-radsl.html
llApplyImpulse (<2, 0, 0>, FALSE);
default {
state_entry () {
llSetStatus (1, TRUE); // make sure that Physical is turned on
}
collision_start (integer total_number) {
if( llDetectedKey(0) == llGetOwner() ) {
llSay (0, "Collided with "+llDetectedName (0));
llApplyImpulse (<2, 0, 0>,> FALSE);
}
}
}
llGetOwner
进行检查,那么您就会与地板不断碰撞,而您的球将会很快消失。
default {
state_entry () {
//每一秒对方圆10米范围对AGENTS扫描1次(同时会trigger sensor event method),
llSensorRepeat ("","", AGENT, 10.0, 3.1415926, 1.0);
}
sensor (integer total) {
integer i;
//循环调用llDetected*方法
for (i = 0; i < total; i ++) {
string name = llDetectedName (i);
llWhisper (0, name+" is within 10 meters");
}
}
}
default {
touch(integer total_number) {
llSensor("","",AGENT,20, 3.1415926);
}
sensor(integer total_number) {
llWhisper(0, "I see "+llDetectedName(0));
}
}
llSensorRemove
方法来
来停止循环的传感器,然后在重新启动循环扫描之前扫描并处理它
default {
state_entry() {
state single;
}
}
state repeat {
state_entry() {
llSensorRepeat("","",AGENT,20,3.1415926, 1.0);
}
sensor(integer total) {
llSay(0, "Repeating: I see "+(string)total+" agents.");
}
state_exit() {
// turn off the repeating sensor
llSensorRemove();
}
touch(integer total) {
state single;
}
}
state single {
state_entry() {
// fire a sensor once
llSensor("","",AGENT,20,3.1415926);
}
sensor(integer total) {
llSay(0, "Once: I see "+(string)total+" agents.");
}
state_exit() {
// clean up the single sensor
// even though it isn't repeating,
// we might leave this state before the sensor fires once
llSensorRemove();
}
touch(integer total) {
state repeat;
}
}
default {
state_entry() {
//该方法是设置“当有人要坐到object上”时该坐在object的哪个位置
//而不是执行坐这个动作
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
}
changed(integer change) {
//表示有人坐到object上
if (change & CHANGED_LINK) {
llWhisper(0, llKey2Name(llAvatarOnSitTarget())+" sat down.");
}
}
}
default {
touch_start(integer detected) {
llRequestPermissions(llDetectedKey(0), PERMISSION_ATTACH);
}
run_time_permissions(integer perm) {
if (perm & PERMISSION_ATTACH) {
llAttachToAvatar(ATTACH_RLARM);
}
}
}
default {
touch(integer total) {
key avatar = llDetectedKey(0);
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer perm) {
if (perm & PERMISSION_TRIGGER_ANIMATION) {
llStartAnimation("clap");
}
}
}
llStopAnimation("clap")
来中断。要查看您是否仍旧在运行此动画,调用
llGetAnimationList
。