Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

One way prim

Billy Fieschi
Registered User
Join date: 21 Jul 2006
Posts: 9
07-14-2008 02:36
Does anyone know of anyway to make a prim one way,
i.e. phantom one side solid on the other, you can walk through it but not back.

Thanks
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
07-14-2008 03:32
You can't do this with prim settings, you'd need to use a script triggered with llVolumeDetect. Rougly speaking, in collision_start get the avatars direction with llDetectedVel( num ), compare to the prim direction ( llGetRot() ) to decide whether to let the avatar pass, or to use llPushObject to send them back the way they came.

PS: feel free to copy and paste this answer into a thread in "Scripting Tips" if you need more help as it's more appropriate there.
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
07-14-2008 03:47
If you must do it with one prime then the method described by Domino is about they only way to do it.

If you can spare a second prim the scripting becomes a lot easier.
Link the two prims.

drop this script into the root.

CODE

default
{
collision_start(integer total_number)
{
llSetStatus(STATUS_PHANTOM, TRUE);
llSleep(0.5); //Adjust the time to suit
llSetStatus(STATUS_PHANTOM, FALSE);
}
}



And this one into the child prim.

CODE

default
{
collision_start(integer total_number)
{
}
}


Now if you walk into it from the root side you can walk through, but from the child side you can't.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
07-14-2008 12:37
Here's another scripting solution that works. The wall you drop this into is non-phantom by default and can only be made phantom (for 20 seconds) by voice command from the owner. As soon as you walk through the wall, it reverts to non-phantom. It's essentially the same approach that Beverly suggested, but it takes only one prim instead of two, and responds only to the wall's owner.

---------------------
CODE


// phase_length is the length of time in seconds to hold phantom state
float phase_length = 20.0;
integer CHANNEL = 2;
integer locked = 1;
help()
{
llWhisper(0,"Only the owner can control this safety unit");
llWhisper(0,"Owner, to enter or exit, say '/2 pass'");
}
default
{
state_entry()
{
// Set status to not phantom on start just in case it got stuck as phantom
llSetStatus(STATUS_PHANTOM, FALSE);
llListen(CHANNEL, "", NULL_KEY, "");
}

listen(integer CHANNEL, string name, key id, string message)
{
if (llToLower(message) == "help")
{ help();}
if (id == llGetOwner())
{if ( llToLower (message) == "pass")
{
llSetStatus(STATUS_PHANTOM, TRUE);
llOwnerSay ("Wall open.");
locked = -1;
state safetywall;
}
}

}
}
state safetywall
{
state_entry()
{
llSetStatus(STATUS_PHANTOM,FALSE);
}

collision_start (integer num_detected)
{
// check to see if the person who bumped into the wall is the owner
if ((llDetectedKey(0) == llGetOwner()) && locked == -1)
{
llSetPrimitiveParams([PRIM_PHANTOM,TRUE]);
// if the above is true and the wall is not locked, then phase out the wall to allow passage by applying a phantom state to the prim
}

}

collision_end (integer num_detected)
{
state default;
}

}

Tegg Bode
FrootLoop Roo Overlord
Join date: 12 Jan 2007
Posts: 5,707
07-15-2008 02:09
Someone was selling them in SL at some stage and they did work, so it can be done, a mze with a few random one way walls/floors get's intreresting.
_____________________
Level 38 Builder [Roo Clan]

Free Waterside & Roadside Vehicle Rez Platform, Desire (88, 17, 107)

Avatars & Roadside Seaview shops and vendorspace for rent, $2.00/prim/week, Desire (175,48,107)
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
07-15-2008 06:01
I was going to have a go at writing the one prim version, only to find a lot of the work has already been done, so i give you this thread.

/54/9f/102662/1.html

Rolig your solution is nice, but i don't think it address the OP requirment of a one way door,
to do that you somehow need to determine which side of the door they are on.

For the simpler scripts you are stuck with detecting collision, because you can always camera around and touch the other side of the door :(

So I think you are stuck with using (what to me is black magic) as in the cited thread or using the second prim.

I have used the 2 prim code in a maze I built so I know it works.

In the meantime vote for

http://jira.secondlife.com/browse/SVC-519

Although that does not solve the camera around problem, it is something that is needed.

Edit: the OP never mentioned a door we just assumed that is what he wanted :)
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
07-15-2008 12:02
Another way to do it is through an attachment, similar to how the Carnival of Doom does this for their "Hell" waiting room.

All the attachment has to do is know where the avatar is and use llMoveToTarget to force the avatar back to a given position.
_____________________
---
Billy Fieschi
Registered User
Join date: 21 Jul 2006
Posts: 9
08-11-2008 07:17
Thank you for all your help, that is great, your all loverly, :)
Nalates Urriah
D'ni Refugee
Join date: 11 Mar 2008
Posts: 113
08-11-2008 17:16
One other thing. Supposedly in viewer 1.21 (the next one) scripts are SUPPOSED to be able to detect where an object was touched.

You may want to follow: /54/ab/271505/1.html
_____________________
Nalates Urriah
D'ni Refugee - Guild of Cartographers