Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector target;
- key targetKey;
- vector vLin(vector x, vector y, float t){
- return x*(1-t) + y*t;
- }
- // Released into public domain. By Nexii Malthus.
- default
- {
- state_entry()
- {
- llSay(0, "Hello, Avatar!");
- }
- touch_start(integer total_number)
- {
- llSensor("target","",ACTIVE|PASSIVE,20.0,PI);
- }
- sensor(integer sensed){
- targetKey=llDetectedKey(0);
- vector vTarget=llList2Vector(llGetObjectDetails(targetKey,[OBJECT_POS]),0);
- vector vPos=llGetPos(); //object position
- float fDistance=llVecDist(<vTarget.x,vTarget.y,0>,<vPos.x,vPos.y,0>); // XY Distance, disregarding height differences.
- llRotLookAt(llRotBetween(<1,0,0>,llVecNorm(<fDistance,0,vTarget.z - vPos.z>)) * llRotBetween(<1,0,0>,llVecNorm(<vTarget.x - vPos.x,vTarget.y - vPos.y,0>)),1.0,0.1);
- vector v = vLin(vPos,vTarget,0.5);
- llSetPos(v);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment