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
-
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1142 times
Issues with osNpcSetRot
- These users thanked the author Graham Mills for the post (total 2):
- Gusher Castaignede • Ilan Tochner
- Gusher Castaignede
- Posts: 270
- Joined: Tue Mar 17, 2015 10:03 pm
- Has thanked: 314 times
- Been thanked: 260 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!
- These users thanked the author Gusher Castaignede for the post (total 2):
- Shandon Loring • Graham Mills
-
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1142 times
Re: Issues with osNpcSetRot
Thanks, Gusher. Will experiment further.
- These users thanked the author Graham Mills for the post:
- Gusher Castaignede