2toe Bigboots Posted June 25, 2011 Share Posted June 25, 2011 I have found a script that is suposed to move object along recorded path can someone tell my why i can make it work. Its straight forword to record but i cant figure out how to start movment// CATEGORY:Tour // DESCRIPTION:Way point recording // ARCHIVED BY:Ferd Frederix list waypoints = []; integer waypoint = 0; integer chat_listener = 0; string replaceString(string pattern, string replace, string source, integer count) { while(count-- != 0) { integer index = llSubStringIndex(source, pattern); if(index < 0) return source; source = llInsertString(llDeleteSubString(source, index, (index + llStringLength(pattern) - 1)), index, replace); } return source; } string ce(integer c, string t, string f) { if(c == TRUE) return t; else return f; } show_dialog(key user) { integer wpcount = llGetListLength(waypoints) >> 1; llDialog(user,"We are at waypoint " + ((string)(waypoint+1)) + "/" + ((string)wpcount) + "\nPosition: " + (string)llList2Vector(waypoints,waypoint<<1) + "\nRotation: " + (string)llList2Rot(waypoints,(waypoint<<1)+1),[ce(waypoint > 0, "<", " "),"save",">","clear","load"],-19923); } save() { if(waypoint >= llGetListLength(waypoints) >> 1) waypoints = (waypoints=[]) + waypoints + [llGetPos(),llGetRot()]; else { waypoints = llListReplaceList(waypoints, [llGetPos(), llGetRot()], waypoint << 1, (waypoint << 1) + 1); } } unsave() { if(waypoint >= llGetListLength(waypoints) >> 1) save(); else { llSetPos(llList2Vector(waypoints, waypoint << 1)); llSetRot(llList2Rot(waypoints, (waypoint << 1) + 1)); //llMoveToTarget(llList2Vector(waypoints, waypoint << 1),0.25); //llRotLookAt(llList2Rot(waypoints, (waypoint << 1) + 1), 1, 0.25); } } say() { list tmp = []; integer i = llGetListLength(waypoints); vector sp = llList2Vector(waypoints, 0); while(i>=2) { tmp = (tmp=[]) + [llList2Vector(waypoints, i - 2) - sp, llList2Rot(waypoints, i - 1)] + tmp; i-=2; } string str = "vector start = " + (string)sp + "; list waypoints = [" + llDumpList2String(tmp, ", ") + "];"; llSay(0, str); } default { touch_start(integer num) { llListen(-19923,"","",""); save(); show_dialog(llDetectedKey(0)); } listen(integer chan, string name, key user, string msg) { if(chan == 0) { if(llGetSubString(msg,0,4) != "load ") return; llListenRemove(chat_listener); chat_listener = 0; save(); say(); list tmp = llCSV2List(llGetSubString(msg,5,-1)); waypoints = []; waypoint = 0; while(waypoint<llGetListLength(tmp)) { vector v = (vector)llList2String(tmp, waypoint++); rotation r = (rotation)llList2String(tmp, waypoint++); llOwnerSay((string)v); waypoints = (waypoints=[]) + waypoints + [v,r]; } waypoint = 0; unsave(); } else if(msg == "<") { save(); if(waypoint > 0) waypoint--; unsave(); } else if(msg == ">") { save(); waypoint++; unsave(); } else if(msg == "save") { save(); say(); return; } else if(msg == "clear") { save(); say(); waypoint = 0; waypoints = []; save(); } else if(msg == "load") { llSay(0,"Type \"load <x,y,z>,<x,y,z,s>,...\" in chat..."); chat_listener = llListen(0,"","",""); return; } else llOwnerSay((string)name+"("+(string)chan+"): "+msg); show_dialog(user); } } // END / Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 25, 2011 Share Posted June 25, 2011 You can't, with that script. It does exactly what it says... //DESCRIPTION: Way point recording. If you want to have an object follow the waypoints, you'll have to write a script to do it. Make your object physical and use llMoveToTarget to aim your object at each of the waypoints in succession. If you've never tried this, it will be a pain at first, especially if you want the object to rotate so that it points along the path all the time. Fun, though. :smileyhappy: Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 25, 2011 Author Share Posted June 25, 2011 How smooth does something like this move to target location? Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted June 25, 2011 Share Posted June 25, 2011 llMoveToTarget gives you a fairly smooth movement - play with it a bit. Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 25, 2011 Author Share Posted June 25, 2011 Ya gonna have to i did just now a little bit its close enough. I do wonder if theres a way to make the movement randome but stay with in a radius Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted June 25, 2011 Share Posted June 25, 2011 Of course it is - it's just a bit of math. Without having really done it before, I think there are several ways in which you can do it. But if you ave a center, a radius around it and a random point, you can tell if the llVecDist <= radius Link to comment Share on other sites More sharing options...
2toe Bigboots Posted June 26, 2011 Author Share Posted June 26, 2011 I need some help making the a object wonder my land randomly kinda like its bord and just strolling around. im attempting llMoveToTarget but havent gotten verry far Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now