|
Evan Oud
Registered User
Join date: 18 Apr 2005
Posts: 30
|
02-23-2006 13:22
Is it possiable to make llSetPos go more then 10M per call? Because I am wanting to make something that can go really fast with no-physics. Any help? Thanks
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
02-23-2006 13:47
No, a single llSetPos call won't move an object beyond 10m of distance. Use more than 1 maybe ? You can get smooth movement by multithreading 4 continuous setpos loops running in 4 seperate scripts, if they're coordinated correctly.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
02-28-2006 04:34
Or repeat it until it reaches where you want it to move. vector TargetPos = <"your target's vector">; while(llVecDist(llGetPos(), TargetPos) != 0) { llSetPos(TargetPos); }
_____________________
 Seagel Neville 
|
|
Candide LeMay
Registered User
Join date: 30 Dec 2004
Posts: 538
|
02-28-2006 04:44
Make that while(llVecDist(llGetPos(), TargetPos) > 0.001)
Comparing floats to zero is not recommended/reliable
_____________________
"If Mel Gibson and other cyberspace writers are right, one day the entire internet will be like Second Life." -- geldonyetich
|
|
Harris Hare
Second Life Resident
Join date: 5 Nov 2004
Posts: 301
|
02-28-2006 07:56
Here's how to use multiple scripts to "thread" the movement and make it even faster. In your main script put: default { touch_start(integer num) { llMessageLinked(LINK_THIS, 0, "<128, 128, 100>", "go"); }
link_message(integer sender_num, integer num, string str, key id) { if (id == "go") { vector TargetPos = (vector)str; while(llVecDist(llGetPos(), TargetPos) > 0.001); llSay(0, "We're here!"); } } } Then add two new scripts and make them both identical to the following: default { link_message(integer sender_num, integer num, string str, key id) { if (id == "go") { vector TargetPos = (vector)str; while(llVecDist(llGetPos(), TargetPos) > 10.000); } } } Basically, when the main script sends the message to "go", all three scripts will start moving towards the destination in tandem. The two helper scripts will drop out of their loops first (when within 10 meters) while the main script will make the final move to TargetPos.
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
02-28-2006 10:03
Harris, there's a 0.05 second delay between events like link_message, so adding the 0.2 delay of llSetPos, your example won't be much faster than a looping llSetPos. With one more child script, though, it'll be twice as fast. I've found that using infinite loops in the child scripts to get rid of the inter-event delay works better overall: main script, just change the scripts names for the secondary scripts default { touch_start(integer num) { llMessageLinked(LINK_THIS, 0, "<128, 128, 100>", "go"); }
link_message(integer sender_num, integer num, string str, key id) { if (id == "go") { vector TargetPos = (vector)str; while(llVecDist(llGetPos(), TargetPos) > 0.001); llResetOtherScript("secondary script 1"); llResetOtherScript("secondary script 2"); llSay(0, "We're here!"); } } }
scondary script: default { link_message(integer sender_num, integer num, string str, key id) { if ((string)id == "go") { vector TargetPos = (vector)str; while(TRUE) llSetPos(TargetPos); } } }
For smoother looking movement you can even add a little variable delay before the loop in each secondary script, dependant on the script's name (here it is configured for a 4-scripts multithreading over 0.2 second frequency): default { link_message(integer sender_num, integer num, string str, key id) { if ((string)id == "go") { vector TargetPos = (vector)str; llSleep(0.05 * (integer)llGetSubString(llGetScriptName(), -1, -1)); while(TRUE) llSetPos(TargetPos); } } }
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|