Compass

How can I make a compass for my game?

hey neato i did it… my first compass =D easiest python script next to (print “hello”) :wink:
http://zerooneentertainment.org/blengine/blends/compass.zip

heres how it works
make sure both the main character and the compass needle’s axis’ are the same. the needle simply copies the rotation of the character.
then i parented the needle to a compass so i could rotate the compass 90 degrees to face the camera.
main character has one line you need to copy:
always >> python(“getOr”)
the needle also has one line:
always >> python(“setOr”)

thats all :stuck_out_tongue:

This is thankfully a very easy question to answer.

make an arrow…point it in norths direction,
from the same origin(center point of object) create an Empty.
select the arrow, shift select the empty
hold ALT Gr and press P

Then make the Empty the child of the camera of your sceen.

Note you could use a texture of a compass on a plane rather than an arrow, but for 3D games, a modelled arrow is usually best.

-Luke

I’m very, very new to Python. Can you help me here? I have no idea what I’m supposed to do. as far as I can tell, I copied your file exactly, but blender won’t do what it’s supposed to and just keeps saying, “there is no variable called ‘own’”.

“there is no variable called ‘own’”.

hmm, maybe you typed in a letter in one of the scripts by accident…
look at both scripts, make sure they both look like this:

setOr looks like:
own = GameLogic.getCurrentController().getOwner()
own.setOrientation(GameLogic.ori)

getOr looks like:
own = GameLogic.getCurrentController().getOwner()
GameLogic.ori = own.getOrientation()

make sure both top lines are “own”, not anything else… delete any extra letters you probably typed in by accident… sometimes i press ‘p’ to play while the mouse is over a script, that will type in a P wherever the cursor is and you might not have known it =)
let me know if that fixes it

My idea would be to use the “Track To” and have a mesh at the north of the compass, parented to it. My idea has a few flaws, but hey, I can’t do everything.

My idea would be to use the “Track To” and have a mesh at the north of the compass, parented to it. My idea has a few flaws, but hey, I can’t do everything.

thank you for sharing your flawed idea… :expressionless:

well the track to would work very well. just have it always face an object really really really really far away (if it’s too close north from the arrow will change positions) then have a that north arrow parented to the acual compass and it’ll work like a normal one. i’ve used this method before (don’t have any examples %| ) and it’s very easy and simpel

Hello

and thank you Blengine for the nice script!!
It works perfectly!!
No doubt, knowing Python can add much power to the game engine!!
Bye
António

(o_0) cool, thanks Blengine, really cool and easy to use it maybe for my game. Do you also have another simple cool python scripts? :wink:

Do you also have another simple cool python scripts?

well im trying to put together a nice page of python scripts, but i cant figure out how to make a lens flare script yet :-? been stuck on that for a bit…are you looking for anything specific or was that just a general question?

:stuck_out_tongue:

Nope, just a general question. So you’re looking for a lensflare script. ask the person who made the yellowcake ufo, he got a script which he get from tonberry ?

Argghhhh! :x Python works for everybody but me… I still haven’t been able to get the compass to work.

So you’re looking for a lensflare script. ask the person who made the yellowcake ufo, he got a script which he get from tonberry ?

not looking for one, im trying to make own =) ive got 2 examples, peters park demo and lizards crackhouse demo but having trouble making sense of them =\ bah… ill get there one day

Argghhhh! Python works for everybody but me… I still haven’t been able to get the compass to work.

damn, could you send me your blend with it so i can check it out and make sure everything is correct?

Er, I got frustrated and destroyed the compass (not that there was much). Maybe if you could just tell me exactly what I need to do? So far I’m just kind of shooting in the dark when it comes to Python, I’m really new here.

Sorry for the extreme inconvenince I must be causing everybody. You can ignore me if you like, but I’d prefer that you didn’t. :wink:

Er, I got frustrated and destroyed the compass (not that there was much). Maybe if you could just tell me exactly what I need to do? So far I’m just kind of shooting in the dark when it comes to Python, I’m really new here.

i told you everything in the first reply post…append scripts, create character, create needle, make sure axis’ are the same, copy logic bricks of character and needle… its ok if you know nothing of python, you dont have to write any :wink: