Hi!
I've been working on a script somone put into the public domain, trying to adapt it to my purpose, which is to rez an NPC when it receives a message via a Dataserver call. Broadly, it works fine, but upon rezing, I want the NPC to adaopt the included (static) animation and to face a particular direction. It's this last part that won't work. No matter what value I put in for the Z rotation, the NPC will behave as follows:
1) It tends not to change direction at all for small (Less than about 7 or 8 degrees) increments/decrements of Z
2) Then it will suddenly change direction by an estimated 20 or so degrees.
3) it cannot be made to face any direction in between it's two jumps
4) For some values, it jumps into a wildly different direction.
5) Overall, it seems to be a toss up between only about 4 or 5 directions it will face, and none other, no matter which of the 360 degrees I try.
Here's the relevant piece of code I believe. Where you see "185" in this example; that's the value I'm changing, but the results don't change as expected/intended. Clearly I'm doing something wrong here, but can anyone tell me what?
if(npc_on == FALSE)
{
npc = osNpcCreate("", "", npcPos, npc);
npc_on = TRUE;
llSensor("", "", AGENT | NPC, 96.0, PI);
vector xyz_angles = <1.0, 1.0, 185.0>;
vector angles_in_radians = xyz_angles * DEG_TO_RAD; // Change to Radians
rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
osNpcSetRot(npc, rot_xyzq);
osNpcPlayAnimation(npc, "My animation");
}
Thank you in advance for your thoughts!