|
|
> vector bbox1 = <pos.x - left, pos.y + boxlen, pos.z - bottom>;
> vector bbox2 = <pos.x + right, pos.y + boxlen, pos.z + top>;
> vector bbox3 = <pos.x - left, pos.y + boxlen + length, pos.z - bottom>;
> vector bbox4 = <pos.x - right, pos.y + boxlen + length, pos.z + top>;
Do you mean "pos.x + right" in that last line?
> integer isInsideBox(vector bbox1, vector bbox2, vector bbox3, vector bbox4)
> {
> vector P = llDectectedPos(0);
> vector A1 = <bbox1.x,bbox2.y,bbox1.z>;
> vector B1 = <bbox2.x,bbox2.y,bbox1.z>;
> vector C1 = <bbox2.x,bbox1.y,bbox1.z>;
> vector D1 = <bbox1.x,bbox1.y,bbox1.z>;
> vector A2 = <bbox3.x,bbox4.y,bbox3.z>;
> vector B2 = <bbox4.x,bbox4.y,bbox3.z>;
> vector C2 = <bbox4.x,bbox3.y,bbox3.z>;
> vector D2 = <bbox3.x,bbox3.y,bbox3.z>;
If you substitute in your values for bbox1-4 from above you get the
following (I left out the pos.x,pos.y,pos.z):
A1 = <-left , boxlen , -bottom>
B1 = < right , boxlen , -bottom>
C1 = < right , boxlen , -bottom>
D1 = <-left , boxlen , -bottom>
A2 = <-left , boxlen+length , -bottom>
B2 = < right , boxlen+length , -bottom>
C2 = < right , boxlen+length , -bottom>
D2 = <-left , boxlen+length , -bottom>
Is this really what you are expecting?
If you are trying to see if a point is inside a box, then it might be
simpler to think of the box as being bounded by 6 infinite planes (one
for each face), then testing which side of each plane the point is on.
If it's on the "inside" of all 6 planes then it's inside the box.
Post a reply to this message
|
|