Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Artificial Horizon indicator

Starbuckk Serapis
Registered User
Join date: 10 Nov 2006
Posts: 114
08-28-2007 23:17
I am trying to make an artificial horizon indicator for a ship I'm working on. In english, thats the little blue over green ball that shows the aircraft's position in relation to the horizon by angle of attack.

I am close...but the rotation is going backwards it seems. When sitting on ground, at <0,0,0> I have the ball lined up so the "N" is visible when looking to the north (ship is pointed east as that is <0,0,0> in SL for some peculiar reason.

Here is the command I am using:

llSetLocalRot(ZERO_ROTATION * llGetRootRotation());

Unfortunately there are two problems:

1. When I take off and turn toward the north, the ball rotates in the wrong direction so I am looking at the ball as if I am pointing south instead of north.
2. The ball is not rotating correctly with roll or pitch. Hard to zero in on what angle I"m ending up with.

Basically, the ball should ALWAYS be at 0,0,0 global no matter which direction the craft is pointing. I've seen a few things about rotations etc, but my eyes glaze over at all the math. What am I missing here?

I've tried llSetRot and using global 0,0,0 but no go.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-29-2007 02:57
No idea how to explain rotations, but the general idea here is that you want to *correct* the desired local (ZERO) rotation for that of the root, so you'll be dividing. Okay, I know, that didn't help at all. Anyway, try:

llSetLocalRot(ZERO_ROTATION / llGetRootRotation());
Starbuckk Serapis
Registered User
Join date: 10 Nov 2006
Posts: 114
08-29-2007 08:38
From: Qie Niangao
No idea how to explain rotations, but the general idea here is that you want to *correct* the desired local (ZERO) rotation for that of the root, so you'll be dividing. Okay, I know, that didn't help at all. Anyway, try:

llSetLocalRot(ZERO_ROTATION / llGetRootRotation());



Actually..it helped tremendously...it worked! Can't ask for better help then that :D. Thanks!