Issues with osNpcSetRot

Creating scripts
Post Reply
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Issues with osNpcSetRot

Post by Graham Mills »

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.
These users thanked the author Graham Mills for the post (total 2):
Gusher CastaignedeIlan Tochner
User avatar
Gusher Castaignede
Posts: 261
Joined: Tue Mar 17, 2015 10:03 pm
Has thanked: 291 times
Been thanked: 253 times

Re: Issues with osNpcSetRot

Post by Gusher Castaignede »

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:

Code: Select all

vector xyz_angles = <0.0, 0.0, 185.0>;
This will rotate your NPC around the Z-axis only, which might be what you’re trying to achieve.
Luck, hope you solve it!
These users thanked the author Gusher Castaignede for the post (total 2):
Shandon LoringGraham Mills
Image
"lnteractivity, Variety, Ease of Use"
Visit my store at Country Manor
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Issues with osNpcSetRot

Post by Graham Mills »

Thanks, Gusher. Will experiment further.
These users thanked the author Graham Mills for the post:
Gusher Castaignede
Post Reply