Library: Truly Simple Door Script
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-01-2007 14:22
Simplest Hinge Script Ever /*//( v7-D Feebie Type 1 Hinge Script )--//*/ /*//-- Works At ANY Angle --//*/
/*//-- NOTES: works in ANY single prim door, linked or un-linked works in muti prim doors NOT linked to a larger structure //*/
/*//-- REQUIREMENTS: a cut root prim, suggest cube, pathcut start=.125, end=.625 //*/
/*//-- CAVEAT: single prim doors are limited to 5m width //*/
/*//-- USERS MODIFY HERE v --//*/ integer gIntSwing = 90; /*//-- use -# to reverse the direction of swing, eg. -90; --//*/
rotation gRotSwing;
default{ state_entry(){ gRotSwing = llEuler2Rot( < 0.0, 0.0, (float)gIntSwing * DEG_TO_RAD> ); } touch_start( integer vInt ){ llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() ); } }
/*//-- IF Redistributing as-is: Please leave script full permissions & include all comments //*/
to use in lids, create lid as normal, move/rotate (via object edit) into place, done. to create realistic hinge action: path-cut start = .125, end = .375 OR path-cut start = .375, end = .625
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Pending Destiny
Registered User
Join date: 28 Nov 2007
Posts: 3
|
01-22-2008 15:13
This is almost exactly the script I use in my doors, and today it suddenly had the odd behavior that if the building isn't aligned on a 90 degree angle (0,90,180,270) to the world axis, nothing happened in the call to llSetLocalRot...
Anyone ever seen that before? Rotating the building to align with a world axis makes it work again, and rotating off the axis breaks it again.
I rezzed the building in both Turbo and Mobit sandboxes and played around rotating it a bit and it behaved the same in both sims.
Even more oddly the sliding door I wrote in another part of the building is also having the same problem, and it doesn't use rotation. I ran out of time to investigate, but it seems that with the build rotated, llSetLocalPos does nothing, but aligned it works as expected.
llGetLocalPos and llGetLocalRot appear to be returning correct values whether the build is rotated or aligned.
|
|
Pending Destiny
Registered User
Join date: 28 Nov 2007
Posts: 3
|
01-22-2008 16:38
Ok, got home and got to check some more. Turns out it is the build itself. Rezzed new copies and it still failed when rotated. Rezzed an older version of the build saved a day or two ago, and they work fine rotated.
Also new, is now the walls are flashing and other oddness. I've had builds "go bad" before, but this is a first.
I've also had linked builds rez unlinked, and attempting to relink results in the "unable to link - too far" message, but this is an odd one.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-22-2008 16:49
when I first built this door I was using rotation division to swing the door back... which was NOT what you want to do, because it only works at zero rotation for local rotation... (with certain exceptions) for ease and portability combining rotations should use multiplication.
anyways before I'd realized that error I'd noticed really odd behavior... on a level the door would flip one way, then another, and tilted it would end up back in the original position sometimes, but with a higher or lower local Z
without seeing you code I can only suggest making sure the formula is Amount2Rot * CurrentRot, and beware of using Set Prim Params as it has a special bug related to local rotations (jira SVC-93 for the problem and a work around)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Pending Destiny
Registered User
Join date: 28 Nov 2007
Posts: 3
|
01-23-2008 15:23
I'm not doing rotation division. It is the same script in both the working build and the non-working build, so it is pretty clearly something corrupted beside the script in the newer linked version of the build.
Besides, as I noticed before, the sliding door is affected too and it isn't doing any rotation. It just seems to be something "bad" about the linkage of the build, since it is the llSetLocalPos and llSetLocalRot calls that fail.
To be sure, I dropped a new (non-linked) copy of the door beside the broken one, and it works fine until linked to the rest of the structure.
Interestingly, unlinking the whole thing and attempting to relink back together fails, even though it is only 20x20x5 meters and around 20 prims. (And was linked to begin with!) The relink of the outer shell alone (20m across and 16 prims) also fails with the same infamous "object too far" error.
This makes it pretty difficult to tell which part may have gotten corrupted and how. After all, it is a pretty simple box type build, with one of the floor panels being the root prim. All the visible attributes appear correct.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-23-2008 19:51
some code to disect would be helpful....
and I'll assume you meant llSetPos
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|