可以使物体缓慢旋转的脚本


Second Life中文指南 http://www.secondlifecn.com/ 第二生命 第二人生 Second Life&HiPiHi玩家基地 查看完全版 查看精简版
 提醒您:如果本页图片或Flash动画无法正常显示,请点击这里访问原帖。
可以使物体缓慢旋转的脚本 作者:Tony 时间:2007-1-17 17:29:04 1
基本的门脚本,touch之后可以开关
rotation interval;
float strength;
integer i = 0;
default
{
    state_entry()
    {
        vector pos = llGetPos();

        //sets pos at where object is made
        llMoveToTarget(pos,0.1);
        //pos is where to move to,,,0.1 is how fast it'll get there
       llSetStatus(STATUS_PHYSICS,TRUE);
        //for enabling physics (putting this after the 11movetotarget
        // allows us not to use the 11sleep call
       strength = llGetMass();
        //Nada Epoch says,and now, there is a nice call that will get
        // you the mass without having to use physics equations to get it
    }
    touch_start(integer total_number)
    //everything in the { } below the touch_start gets done
    //(read) when you touch the object
   {
        i++;

        //Nada Epoch says, i thought origianly you could use the integer
        //total_number, but, that only keeps track of how many avatars touch it,
        // not how many times it gets touched, so to make the counter increment
        // by one put in....same as saying i=i+1
       interval=llEuler2Rot(<0,0,i*PI/6>);
       //in the (< and >)  the first three components are the axis of rotation
       //and the last one is the actual angle, the vector that is inside the
       //ll Euler2Rot call is a representation of how the object is rotated, so
       //we want it to rotate 0 about the x axis, 0 about the y axis, and 30 degrees
       // about the z, PI is 180 degrees, so PI/6 is 30---that means that we are
       //multipling 30 degrees times the number of times the object has been touched........
       //ok so what the llEuler2Rot does is it translates a the angles from the euler axis,
       // to a rotation
       llRotLookAt(interval,(strength)/20,strength/20);
       //this is telling the object to rotate to the specific rotation "interval" over time
       //"strength/20", with force "strength/2"  the scripting doc says that good forcevalues
       //are half of the mass, and good time values are one tenth of the force. The force
       //causes a torque which moves the object to the specified rotation
    }
}
所属版面:制造&脚本 本主题第1页
共有回复: 0 共有页数: 1 显示主题数:50 奶粉 U盘生产