|
Deacon Dimsum
Registered User
Join date: 6 Apr 2006
Posts: 7
|
05-29-2006 12:22
What is the best way to check the position of an avatar to an object and return a True or false bast on which side of the object the avatat is? Code snippets would be great if possible. Thanks.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
05-29-2006 12:34
Quick way: use a dot product between the forward vector and the direction to the avatar concerned. e.g. if you have a sensor() or touch_start() etc event, you can use something like this... if ((llRot2Fwd(llGetRot()) * llVecNorm(llDetectedPos(0) - llGetPos())) > 0) { llOwnerSay("In front of me"); }
I think there's a free door thing in my freebie box that illustrates this principle.
|
|
Deacon Dimsum
Registered User
Join date: 6 Apr 2006
Posts: 7
|
05-29-2006 14:57
got it to work for one door, how do I rotate the script so to speak so it checks top and bottom?
|