Independent rotate script becomes ineffective when re-rezed
|
a lost user
Join date: ?
Posts: ?
|
08-15-2005 12:44
/54/8a/44187/1.htmlI used that script. Now it works fine and dandy, but if you re-rez the object from your inventory, the whole object spins instead of just the propeller. To manually fix this, each time I rez the vehicle, I must unlink the propeller, let it spin, then select the propeller first and link it back to the rest of the object. It works fine then. Is there a way to fix this? I don't think I should sell vehicles if they don't rez right =P
|
Zeno Concord
To infinity, and beyond!
Join date: 28 Mar 2005
Posts: 51
|
auto unlink-relink to fix
08-15-2005 15:42
I have written a script which does an automatic unlinking and relinking when you rez an object to fix the problem of getting the parts rotating again. I didnt find any other way that worked as well as this (including setting the alpha to the current alpha) I would be happy to post it, but it is still unreliable for unknown reasons. Perhaps I should add some time delays or other waits.  ..
|
a lost user
Join date: ?
Posts: ?
|
08-15-2005 17:14
Could you post it nonetheless? Maybe I could take a stab at fixing it =)
If you don't want to post it, could you PM it to me then?
Thanks, please get back to me ^^
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
08-16-2005 02:13
Does adding: on_rez(integer p) { llResetScript(); }
to the rotation script help ?
_____________________
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.
|
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
|
08-16-2005 02:33
You may want to consider animated textures for propellers. It has a lot of advantages over prim movement.
|
a lost user
Join date: ?
Posts: ?
|
08-16-2005 08:36
Hmm, how do you make an animated texture? Do you have to spend a lot of Linden dollars uploading different frames of the animation? I can't do that if so because I am on a basic account =(
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
08-16-2005 09:11
It's all one texture, with several parts, and there's a good tutorial here: http://www.slboutique.com/index.php?p=content&contentid=3
|
a lost user
Join date: ?
Posts: ?
|
08-16-2005 14:17
Very very cool, thanks! =D
|
a lost user
Join date: ?
Posts: ?
|
08-18-2005 14:39
From: Zeno Concord I have written a script which does an automatic unlinking and relinking when you rez an object to fix the problem of getting the parts rotating again. I didnt find any other way that worked as well as this (including setting the alpha to the current alpha) I would be happy to post it, but it is still unreliable for unknown reasons. Perhaps I should add some time delays or other waits.  .. Eh, could you post that any ways, please =)
|
Zeno Concord
To infinity, and beyond!
Join date: 28 Mar 2005
Posts: 51
|
Auto-relinker
08-18-2005 20:01
OK, here is my attempted workaround for the problem of llTargetOmega rotations in linked prims not being active when the object is rezzed again. After learning that manually unlinking and relinking makes the rotation start up again, I wrote this pair of scripts to do the relinking automatically. Put this first script in the rotating linked prim, modifying the part that does the rotation however you want. // Set up rotation via llTargetOmega. // To make it work for a linked prim, tell the root prim to relink this prim.
default { state_entry() { llTargetOmega(<0,0,1>,PI,1.0); }
on_rez(integer start_param) { // Just tell Relinker what our link number is. llMessageLinked(0, llGetLinkNumber(), "relink me", llGetKey()); } }
And then put the following script in the root prim of your linked object: // Relinker - this script goes in the root prim of a linked object. // The purpose is to merely relink a linked prim when the object is rezzed. // And the purpose of that is to get it to start rotating again, via llTargetOmega.
integer primNum; key primKey;
relink () { //llWhisper(0, "The prim should be rotating now."); llSetAlpha(llGetAlpha(0), 0); // this updates the client.. maybe llBreakLink(primNum); llCreateLink(primKey, TRUE); }
default { on_rez(integer start_param) { // llSetAlpha(llGetAlpha(0), 0); doesnt work by itself integer currentPerm = llGetPermissions(); //llWhisper(0, "permissions: " + (string)(currentPerm & PERMISSION_CHANGE_LINKS)); if (!(currentPerm & PERMISSION_CHANGE_LINKS)) { // the permissions are not persistent with the object, it seems. llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS); } else relink(); }
link_message(integer sender_num, integer num, string msg, key id) { // The prim reports its link number. primNum = sender_num; primKey = id; }
run_time_permissions(integer perm) { if (perm & PERMISSION_CHANGE_LINKS) { integer currentPerm = llGetPermissions(); //This Whisper may help for some reason. even then, it is not always enough. //llWhisper(0, "permissions: " + (string)(currentPerm & PERMISSION_CHANGE_LINKS)); if (currentPerm & PERMISSION_CHANGE_LINKS) { relink(); } } } }
|
a lost user
Join date: ?
Posts: ?
|
08-19-2005 14:21
That's good but it doesn't work in my case... http://img399.imageshack.us/my.php?image=diagram3eq.jpg(Please view the picture above) Parts 1, 2, 3, 4, and 5 are all linked together as an object, and then the prim named "ROTATING" spins independently from the rest. I applied your script and placed the first (Spinner) script in the "ROTATING" prim, and the second (Un/linker) in the prim equivalent of piece 4. I took a copy and when I rezed it, the whole object spun. Any ideas? I'll edit this post or reply here if I figure out what's wrong or if I'm doing something incorrectly.
|
a lost user
Join date: ?
Posts: ?
|
08-22-2005 14:00
Anyone else have any solutions to this predicament?
|
Kairen Overdrive
Registered User
Join date: 12 Jul 2005
Posts: 38
|
08-23-2005 05:49
Add maybe a delay it seems that the rotating is activated before it could unlink and relink. Make it rotate only when told to in the vehicle script such as seen in helicopter scripts with a llMessageLinked start and stop message.
|
Kujila Maltz
lol
Join date: 6 Aug 2005
Posts: 444
|
09-13-2005 14:48
Any more progress anyone ^^
|
Zeno Concord
To infinity, and beyond!
Join date: 28 Mar 2005
Posts: 51
|
09-13-2005 17:28
From: someone I applied your script and placed the first (Spinner) script in the "ROTATING" prim, and the second (Un/linker) in the prim equivalent of piece 4. I took a copy and when I rezed it, the whole object spun.
If piece 4 is not the root prim, then that would explain why my suggested script does not work. The rotating prim is set up to tell the root prim to relink the rotating prim. I believe only the root prim can do that job anyway, from what I recall., and only the root prim can request the owner for permission to do that un/link operation. The root prim is the last one that you select before performing the linking action, when editing the object in SL. It is also the prim you are operating on when you select and edit the contents of an object, without having selected the option to Edit linked prims. Hope that helps. If we knew what was happening internally, why the rotation fails to resume after rezzing, then it would be far easier to find a reliable and perhaps simpler work-around. I wish the Lindens would at the very least offer such information, if they cannot actually fix the bug.
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
09-14-2005 04:11
llTargetOmega is known to have many issues with linked prims. There are some workarounds, but they require quite a bit of code to work properly (you can see how much code Zeno had to implement, and it still has some issues) so I would like to come back to the animated texture idea.
llSetTextureAnim can ROTATE textures - so create a flat disk for your propeller, then draw your prop blades (2 or 4 or however many) in your graphics with a transparent background - maybe add a little raidal motion blur for some realism. upload as a single 32bit TGA file (make sure you know how to handle the alpha channel - i'm leaving that description out of this reply in case you do know) and rotate anim it on your disk. because of the alpha, the disk will look like a set of blades, spinning at the speed you choose.
1 gotcha: if you use a sphere or cylinder for the disk you will find texturing it quite difficult. you would have to convert your image from polar to linear co-ordinates before uploading (don't worry if you don't understand this part, please excuse me if you do), so it would probably be better to use a flattened cube instead, but then you may need to worry about the texture repeating (I am not at home, and so cannot test whether or not llSetTextureAnim repeats textures) If it does, make the texture canvas about 50% higher and wider than it needs to be, with a completely transparent border before uploading)
long answer, I know, but difficult to describe. if you have any problems ask again, and i'll put an example together in-world.
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
09-14-2005 05:39
LOL! I never thought I would see the day where people would purposefully use llTargetOmega on a child prim, let alone code a workaround that actually makes it usable! llTargetOmega is not supposed to work "independently". Be forewarned that if you rely on bugs for your stuff to work, they will break when LL fixes it.
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
09-14-2005 05:46
From: someone Hmm, how do you make an animated texture? Do you have to spend a lot of Linden dollars uploading different frames of the animation? I can't do that if so because I am on a basic account =( You dont need an "animated" texture, not one with frames anyway, just a normal one and llSetTextureAnim... default { touch_start(integer total) { //Increase or decrease rate (in frames per second) to make animation speed faster or slower float rate = 2.0; llSetTextureAnim(ANIM_ON|ROTATE|LOOP|SMOOTH,0,0,0,0,TWO_PI,rate); }
}
|
Slayd Lemieux
Registered User
Join date: 9 Jul 2005
Posts: 29
|
Another angle...
09-14-2005 09:27
Don't know if this would do it, but you can try it.
You could add a llRezObject to your state_entry that rezzed your propeller object in the correct spot. Then in your propeller's state_entry have it link itself to the rest of your vehichle.
If you need the lines of code I can whip it up probably. Lemme know.
|
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
|
09-14-2005 11:15
You could also try using a joint, but they are a bit unstable. So don't blame me if the object explodes on a sim crossing or something 
|