Earnest Clymer
Registered User
Join date: 20 Feb 2005
Posts: 17
|
06-12-2005 23:12
Is the arc you define for a sensor modified by the object's rotation? I'm trying to set up a sensor that will fire for avs detected in the full hemi-sphere around and above the object, but not below. If I understand the docs right, I can only do this if I rotate my object (90 deg. around the y-axis?)
Am I on the right track here?
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
06-12-2005 23:31
Im not sure if what you're attempting to accomplish is possible from just limiting the sensor arc. The arc you specify in the llSensor call is in radians around the object's local positive *and* negative x-axis. So, if you specify an arc of PI radians, you get a sphere around the object (an arc of 180 degs around the positive x, and 180 degrees around negative x). If you specify an arc of PI/2 radians, you get a 90 degree arc at each end of the object's x-axis. In other words, the sensor is always detecting on both ends of the object reguardless of the arc you specify. To do what you ask, you'll have to specify an arc that covers a sphere around the object (PI), then filter by the object's position in the sensor event. Here's how you would do that: sensor(integer detected) { vector myPos = llGetPos(); integer i; for (i = 0; i < detected; ++i) { vector dPos = llDetectedPos(0); if (dPos.z >= myPos.z) { // This detected object is above the sensing object. // Do stuff here... } } }
IMO, LL should have implemented the llSensor function so that the arc parameter specifys angle around *just* the positive x-axis. That way, an arc of PI would be a half-sphere with a radius extending from the object's center towards its positive x, and an arc of TWO_PI would be a full sphere. It makes more sence and would allow you to do what you want without filtering within the sensor event. ==Chris
|