Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

not_at_rot_target() firing when it shouldn't?

Sean Gorham
Stopped making sense
Join date: 5 Mar 2005
Posts: 229
02-14-2006 18:15
I'm making a compass. Based on the suggestions of a couple folks (thanks Rickard and Ice!) I'm using llRotTarget() and the not_at_rot_target() event handler to control when the compass gets updated. The core of the script is pretty straightforward:

CODE
state_entry() {
llRotTarget(llGetRot(), 1 * DEG_TO_RAD);
update(); // update the compass face
}

not_at_rot_target() {
update(); // update the compass face
llRotTarget(llGetRot(), 1 * DEG_TO_RAD);
}
Whenever my current rotation varies by a degree or so, the compass is updated, and the rotational target is changed to match my current rotation.

The above works great 99% of the time. That remaining one percent is annoying the heck out of me, though. When I sit on a prim, not_at_rot_target() fires continuously, even though I am at the rotational target. I've stuck debug stuff in the script to have it spit out my current and target rotations, so I'm pretty sure that part of the script is working correctly.

Here's where it gets even stranger. If I rez a box at zero rotation and sit on it facing east (my butt on face 0, my legs over face 2), the script behaves as it should. If I sit facing any other way on the box, not_at_rot_target() fires despite the target rotation and my current rotation matching. This behavior persists regardless of the prim's rotation, as well. So long as I sit on face 0 with my legs over any face but face 2, it acts weird.

And now for strangess part three: if I add an at_rot_target() handler, even an empty one, this odd behavior described above goes away. :eek:

I could just add an at_rot_target() handler, I suppose, but I wanted to reduce lag if possible, and not having events firing constantly just from sitting down seemed a good way to avoid that. Am I doing something wrong up above, or is this just some oddball behavior of LSL I have to work around or live with?
_____________________
COOL GEAR BY GORHAM
Clothing, Animations, Gadgets and More!
Serpent Isle | Magenta | Manhunt Mall | Sylvina
SLBoutique | SL Exchange
Sean Gorham
Stopped making sense
Join date: 5 Mar 2005
Posts: 229
02-17-2006 10:14
Apologies for the shameless bump, but I've yet to find a solution to this. Any insight would be greatly appreciated!