free movement on a door?
|
|
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
|
10-08-2007 18:12
I modded James Linden's door hinge script to open when collided with and close by itself. I'm want to make the door open outward from the direction the avatar collides with it; to make it follow as if it were a real door which opened both ways. But i'm not sure how. The script I wrote here does half of what I want to do; it doesn't go both ways. I need it to go the opposite way when collided with from the opposite side. Anyone know how to do this? // If door is locked, the name of the avatar who locked it. // If door is not locked, the empty string (""). string gLockedBy = "";
// This number must match the channel number of the lock // and unlock objects you want to use. If multiple doors // have the same channel, then a single lock can lock all of // them at once. integer gLockChannel = 243;
default { state_entry() { llSay(0, "Public Restroom Door"); llListen(gLockChannel, "", NULL_KEY, ""); }
collision_start(integer num_detected) { string name = llDetectedName(0); if (name == gLockedBy || gLockedBy == "") { rotation rot = llGetRot(); rotation delta = llEuler2Rot(<0,0,PI/4>); rot = delta * rot; llSetRot(rot); llSleep(0.25); rot = delta * rot; llSetRot(rot); llSleep(2); } } collision_end(integer num_detected) { rotation rot = llGetRot(); rotation delta = llEuler2Rot(<0,0,-PI/4>); rot = delta * rot; llSetRot(rot); llSleep(0.25); rot = delta * rot; llSetRot(rot); } }
_____________________
From: someone Don't worry, Aniam is here! - Noob
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
10-08-2007 18:20
There is no function that determines what face of a prim is touched or collided with. You would have to make a mat or barrier on each side that the av would collide with. On one side it could llSay(-12897123, "inside"  for example. Then the door would have to have a listen and open one way if it recieves a "inside" message and the other way if it gets a "outside" message.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
|
10-08-2007 18:25
I see. Okay, thanks 
_____________________
From: someone Don't worry, Aniam is here! - Noob
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
10-08-2007 19:06
Now how do the doors on my house work? The doors always open away from you. I can touch the doors from 20 meters if I want and they always open away from the avatar. If I'm outside walking in the door will open in, if in walking out the door opens out. Can't a script figure out which face of the prim is being touched? If not then how do theses doors work?
Oh, just tried it and you can't trick the doors by moving the camera then touching the door. The door still opens away from the avatar. So it's not dependent on the prim face that's touched.
|
|
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
|
10-08-2007 23:33
You get the av id from the touch.
You then scan for the av, and determine his/her position, and calculate which way to move the door.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
10-09-2007 00:10
is it possible to make a 2 part door, laminated style, and have the door script rotate the whole thing based on prim touched (in from the outsde, out from the inside) ?
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
10-09-2007 01:36
From: Void Singer is it possible to make a 2 part door, laminated style, and have the door script rotate the whole thing based on prim touched (in from the outsde, out from the inside) ? That is possible but the solution is simpler than that. From: Ed Gobo You get the av id from the touch.
You then scan for the av, and determine his/her position, and calculate which way to move the door. Simpler than that too, you don't need to scan for the avatar as you already have his/her position from the touch event using the llDetectedPos() function. Check if the avatar is at a position +ve or -ve in relation to the closed state of the door and if you click it the door should open rotating +ve or -ve direction around it's z-axis. This is most likely how Max Pitre's door works. With a collision based door you could instead take the velocity of the avatar and determine which way to open the door from that.
_____________________
www.nandnerd.info http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
|
|
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
|
10-09-2007 02:37
Nand, any chance you can give an example? 
_____________________
From: someone Don't worry, Aniam is here! - Noob
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
10-09-2007 02:40
From: Aniam Ingmann Nand, any chance you can give an example?  Not off the top of my head, had too early a morning for dealing with rotations and vectors. If no-one has posted a solution by then I might get a chance this evening to give it a go.
_____________________
www.nandnerd.info http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
|
|
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
|
10-09-2007 03:41
Okey dokey 
_____________________
From: someone Don't worry, Aniam is here! - Noob
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
10-11-2007 02:40
Sorry bud, not yet had a chance to get cracking on this problem. Hopefully someone might pop along with a solution, failing that you could ask in Products Wanted for someone to script it for you.
_____________________
www.nandnerd.info http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
|