I'm having some difficulty understanding how osNpcSetRot is supposed to work. A web search came up with someone else having similar issues:
https://community.secondlife.com/forums ... te-an-npc/
Any thoughts/code/pointers welcome.
Issues with osNpcSetRot
-
Graham Mills
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1143 times
- Gusher Castaignede
- Posts: 275
- Joined: Tue Mar 17, 2015 10:03 pm
- Has thanked: 316 times
- Been thanked: 266 times
Re: Issues with osNpcSetRot
It seems like osNpcSetRot is a function used to set the rotation of an NPC (Non-Player Character).
The function takes two parameters:
The first parameter is the NPC that you want to rotate.
The second parameter is the rotation that you want to apply, which is represented as a quaternion.
..so from the code from that link, they're converting Euler angles to a quaternion with the llEuler2Rot function, and then passing that quaternion to osNpcSetRot.
Euler angles can sometimes lead to a problem known as “gimbal lock,” which might be why you’re seeing unexpected behavior.
One thing you could try and test is to only change the Z component of the rotation, and leave the X and Y components as zero. This would look something like this:
This will rotate your NPC around the Z-axis only, which might be what you’re trying to achieve.
Luck, hope you solve it!
The function takes two parameters:
The first parameter is the NPC that you want to rotate.
The second parameter is the rotation that you want to apply, which is represented as a quaternion.
..so from the code from that link, they're converting Euler angles to a quaternion with the llEuler2Rot function, and then passing that quaternion to osNpcSetRot.
Euler angles can sometimes lead to a problem known as “gimbal lock,” which might be why you’re seeing unexpected behavior.
One thing you could try and test is to only change the Z component of the rotation, and leave the X and Y components as zero. This would look something like this:
Code: Select all
vector xyz_angles = <0.0, 0.0, 185.0>;Luck, hope you solve it!
-
Graham Mills
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1143 times

