Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
|
07-28-2004 18:27
ok, maybe any math geniouses out there can help me with this one or atleast someone brighter than me BUT how can I determine which side I am on of an object that can be rotated any direction. is it even possible? I know the objects position and rotation and my position and rotation but what magic calculations do I do to say you are on side A? e.g a car door. If i click on it from the outside I can say welcome or if I click on it from the inside I can say, thank you for the ride  I would prefer not using extra prims for this as I think it should be possible somehow.....
|
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
|
07-28-2004 18:48
To the best of my knowledge you would have to use two prims for this as an object reports that it was touched but not where it was touched. Thus even for a cubeoid, your script has no idea even which face was touched, thus the math is sort of irrelevant. Now if you were not using the car as just an example, you can use states to trigger different handlers as in this very rough pseudo-code: state door_closed { touch_start(integer n) { llSay(0, "opening"); // swing the door prim state door_open; } }
state door_open { touch_start(integer n) { llSay(0, "closing"); // swing door shut state door_closed; } }
Hope that helps.
|
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
|
07-28-2004 19:24
Thank you for your help and yes the car door was an example but if I have 2 objects positions can't I find out what position they have to eachother?
|
Siggy Romulus
DILLIGAF
Join date: 22 Sep 2003
Posts: 5,711
|
07-28-2004 19:51
Just a thought -- the question isn't whether your on one side of a door or not.. the question is 'am I inside or outside'..
In a car you're between 2 doors, behind the dash, and in front of the back.
In the case of a SL vehicle you could easily say 'I'm inside if I'm sitting' - because on most vehicles if you unsit you will be moved to a position outside of the vehicle anyways (I say most - as most vehicles are rather small).
Food for thought.
Siggy.
_____________________
The Second Life forums are living proof as to why it's illegal for people to have sex with farm animals. From: Jesse Linden I, for one, am highly un-helped by this thread
|
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
|
07-28-2004 21:26
Yes I think I should be able to know if they are inside or not, just thougth that you could get this from calculating angles somehow.....
|
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
|
07-28-2004 21:58
My apologies for posting too late for coherence, but the answer is a qualified "yes you can".
The big hurdle is that llGetPos() only returns the coordinates of the root of the object and it is quite difficult to get a bounding box of an object. Therefore, You could have two rectangular prims that have non-coincident roots but still intersect. Without further information about what you are trying to accomplish, I don't think I can give you more useful assistance.
To answer the question that you are asking directly, you can compare the positions of two object roots with llVecDist(pos1, pos2) <= epsilon, but I doubt that solves your issue.
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
07-29-2004 00:07
I think what Sitting want's to find out is how to detect if something is behind an "invisible wall" defined by one of the local axes of the sensor object. If I wanted to know if a person was behind the "wall" defined by an object's X axis, I'd first get the object's position, then get the avatar's position, then get the offset from the object to the avatar (av pos - obj pos) and multiply that by the object's rotation. If I remember how I did this before correctly, if the offset.y > 0, then the avatar is on one side of the x-axis wall (the one defined by where the y axis is pointing) and vice versa if offset.y < 0. I usually solve problems like this with trial-and-error, and since I did this so long ago, don't be angry if I didn't remember it 100%  ==Chris
|
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
|
07-29-2004 06:21
I think you're right Christopher I'll try that tonight, thanks!
|