Jump to content

Sines, cosines and tangents question..


Innula Zenovka
 Share

You are about to reply to a thread that has been inactive for 3805 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Think of a right triangle with one corner at the center of the squareand another at one of its corners.  It's two sides are equal in length, each equal to half the length of the side of the square.  The length of its hypoteneuse -- the long side that extends from the center of the square to the corner --- is the square root of the sum of the squares of the other two sides.  So  sqrt( (0.5 * 40)^2 +(0.5 * 40)^2) == 0.5*40 * sqrt(2) = 20 * 1.414= 40 * 0.707.

Oh, and the sensor has to be able to see anything that is as far away as a corner of the square, so that's why you need to know that distance.

EDIT:  Heh..... so I typed a * sign instead of a + and nobody else caught it(!) :smileyembarrassed:

Link to comment
Share on other sites


Innula Zenovka wrote:

... see if something is inside a square at ground level ... 

Note that this all assumes that the sensor and sensed object will be at exactly the same "ground level". Otherwise the Z dimension also matters, making it a problem in solid geometry. (Practically, perhaps pad the sensor range a bit so as to sense objects somewhat above the ground plane in the very corner of the square. If "somewhat" can be quantified, it's the side in another bit of trig.)

Link to comment
Share on other sites

  • 2 weeks later...

I did this back in 2009.  There was nothing fancy to the design.  Here's how I did it...

 

  • Two vectors... min and max are all you need.
  • I made a bounding box detector unit to acquire the bounding box.  You place it in the middle of your room (i.e. there has to be four walls, a ceiling and floor/ground; if in the open, set up four temporary walls, ceiling and floor first; N, S, E, W, Up, Down).  Detector unit moves by physical movement.  Assume there are no obstacles in the room to run into.  If bounding box detector goes outside of the region, it auto dies with a message (llGetRegionName).
  • The detector unit moves until it collides with a wall, then it waits a couple seconds while still applying force against the wall, to ensure a good reading.  It does this for all six directions and stores appropriate position float for the specific direction like this..
  • Move positive in the x direction to a wall = max.x
  • Move negative in the x direction to a wall = min.x
  • Move positive in the y direction to a wall = max.y
  • Move negative in the y direction to a wall = min.y
  • Move positive in the z direction to a ceiling = max.z
  • Move negative in the z direction to a floor = min.z
  • vector min = <min.x,min.y,min.z> and vector max = <max.x,max.y,max.z>
  • I used notecard config, so the min, max vectors were given in local chat for the notecard.
  • While editing the notecard, set your sensor setting for the necessary range from the middle of the room (where you put your security unit) (i.e. as calculated in previous post).
  • In the sensor event, check for llOverMyLand(llDetectedKey(x)) and for llDetectedPos(x) being within low and high x, y and z ranges as specified in min, max vectors.
  • React as needed.
  • Set unit to disappear and be phantom when armed since it will be in the middle of the room.

It worked quite well.  I still use it from time to time.  My partner and I used it to secure our second floor of our house.  Someone came along one day and tried to get upstairs.  They tried several times, but kept getting kicked.  Loads of fun and an easy way to secure your bounding box.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3805 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...