|
Ilana Debevec
Registered User
Join date: 25 May 2007
Posts: 130
|
09-17-2008 15:52
Simple problem that's getting more complex.
Behold a Prim! Root prim to be exact. Prim has a FRONT and BACK side.
AV clicks on prim.
I want to tell if they are standing in FRONT of or in BACK of the prim. (ie. door lock, don't want them to be able to unlock it from the inside). 'z' position is irrelevant, just x/y.
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-17-2008 20:32
Something like... vector pos = llDetectedPos(number) / llGetRot(); if (pos.x > 0) { ... } ...should do it.
_____________________
http://slurl.com/secondlife/Together
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
09-18-2008 09:54
Is this answer accurate?
If so, please explain.
(I wish the division sign wasn't used as an operator for rotation operations).
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-18-2008 10:27
From: SuezanneC Baskerville Is this answer accurate? Oops no it's not! It should use the offset of the target... vector pos = (llDetectedPos(number) - llGetPos()) / llGetRot(); if (pos.x > 0) { ... } 1) Find the position of the target 2) Find the offset of the target. 3) Rotate into the reference frame of the object. 4) Check whether it's in front or behind the object according to the object's reference frame. So yes, the vector division is valid. (Try it  ) /esc
_____________________
http://slurl.com/secondlife/Together
|
|
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
|
09-18-2008 10:38
i did something like this with on my automatic doors that swing in the direction of collision i used 3 prims 2 invisible one one each side and linkmessage what side was touched or collision. ill have to try this formula to save 2 prims 
_____________________
L$ is the root of all evil videos work! thanks SL 
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-18-2008 10:51
Frankly, I've been using this technique for so long I'd forgotten it wasn't generally known. If works nicely for detecting direction of collisions too e.g.
vector vel = llDetectedVel(0) / llGetRot(); if (vel.x > 0) { ... }
/esc
_____________________
http://slurl.com/secondlife/Together
|