I'm back, but because of a question...

I can’t belive that my project has to wait because I have a problem with
the compass…
I made a example of my problem and here it is:
http://www.zone.ee/xintest/compasstest.blend

The compass doesn’t move right so please tell me what’s wrong… I know
it’s my mistake…

Well, your problem is that you slanted the compass and the script doesn’t work that way. I don’t know how to fix it though.

Pooba

Personally, i like to put this kind of thing in an overlay scene. I’ve tweaked your .blend so it works, the compass is in a new scene called ‘compass’ ;), now the script works, but this may not be what you want…

http://mysite.freeserve.com/liftstudios/compasstest.blend

try it an’ see… :smiley:

cheers
Piran

:o

Anyone know where I can find a tutorial that explains how to do something like this?

It’s actually quite easy… Just look at the .blend file

Hey! Thanks saint_pill

The only problem I see with that compass is that it is working opposite to how a compass would work in real life when turning left or right. If you start the game you are facing north. If I turn the cube slightly to the left the compass should point slightly to the right. The way it’s set up right now it’s just moving the exact same way as the cube which isn’t how a compass works. As you turn away from the north (either right or left) the compass needle should point the opposite direction that the cube is turning.

I assumed the needle was supposed to indicate the cubes direction, that’s how the script’s set up, rather than north, but if you want a ‘real’ compass it’s pretty simple. Just change the script that set’s the needles orientation to:

own = GameLogic.getCurrentController().getOwner()

ori = GameLogic.ori
ori[0] = [-ori[0][0], -ori[0][1], -ori[0][2]]
ori[2] = [-ori[2][0], -ori[2][1], -ori[2][2]]
own.setOrientation(ori)

This flips the X and Z axis, giving a mirror image essentially. Note: you don’t really need to flip the Z for it to work, I just did it anyway :stuck_out_tongue: and also you’ll need to turn the needle mesh upside down to see it.

:smiley:

cheers
Piran

PS - to the great python guru’s, if theres a simpler way to negate the elements in the list please point it out :wink:

saint_pill: http://mysite.freeserve.com/liftstudios/compasstest.blend

:frowning: The file isn’t online anymore, does someone has got the .blend on his PC. :slight_smile:

Yup I found an compass .blend, but it doesn’t work right. Btw, has someone got the .blend of the link which doesn’t work anymore? :frowning: