James Samiam
Registered User
Join date: 24 Feb 2005
Posts: 89
|
07-08-2005 20:12
deletionnnnnnnnnnnnnn
|
Michael Martinez
Don't poke me!
Join date: 28 Jul 2004
Posts: 515
|
07-08-2005 22:23
check the script to make sure you use llGetLocalPos(), else it will get pos of the root..
and since a door, it cannot be the root (last clicked) else the object will move to open..
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
07-10-2005 05:47
A simple method is putting the door at its definite place, then dropping the script inside. Have the script initialize by getting the LocalPos and/or LocalRot. When opening apply whatever rotation / position offset to this Rot and/or Pos, when closing apply the original Rot and/or Pos. Code for a rotating door (simple cube prim flattened): (warning I did not test this code just wrote it there) // door that revolves 90 degrees around its +Z edge
vector lpos; rotation lrot; integer IS_OPEN;
vector hinge; rotation ropen;
default { state_entry() { lpos = llGetPos(); lrot = llGetLocalRot(); IS_OPEN = FALSE;
hinge = llGetScale; hinge.x = 0.0; hinge.y = 0.0; hinge.z *= 0.5;
ropen = llEuler2Rot(<0,0,PI_BY_TWO>); }
touch_start(integer i) { //if (llDetectedKey(0) != llGetOwner()) return; // uncomment to make the door respond only to you
if (IS_OPEN) { IS_OPEN = FALSE;
llSetRot(lrot); llSetPos(lpos); } else { IS_OPEN = TRUE;
llSetPos(lpos - hinge + (hinge * ropen)); llSetRot(ropen * lrot); } } }
_____________________
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.
|
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
|
07-12-2005 13:24
I'll post the script I adapted later. It works a little easier with the move-vector defined at the top. :d
|