Compass example?

Hello, is there in any project a compass example?

We don’t have any as far as I know. From a quick Google, it’s pretty tricky as you have to deal with the device orientation:

I tried a couple of samples that I found on the web and none of them pointed to North :frowning:

lol no i mean for a game i don’t care real north :stuck_out_tongue:

Just use Compass.js.

This is maths from 5th school grade, front facig 2D vector of X and Z axes of a camera, is your compass vector, you can then draw that as 2D element. You can convert 2D vector into Eulers.

Gamedev - is not easy. But others won’t do your homework.

thanks @will@max i figured out how it works, i wanted to see the best way for the graphic.

It is case dependent, and each game has own special cases. There is no generic copy-paste scenarios in real-world gamedev.

@max i see…then i have to built it from base… well we will see what comes out :slight_smile:

Hey @ayrin how did you managed to create and configure the UI, I’m more interested in how can I do something like that.

Hi @mimmer, what do you mean exactly? I created icons that lead to proper functions, i used the raphael.min.js to do that but you can do it also with html or other ways, what is your dubt?

The awesome folks over at The 5 seals online RPG have a working compass :slight_smile:

Thanks @Sebastian i’m not that awesome :wink:
@mimmer you can study the drawRose function here

Thanks @Sebastian and @ayrin but I’m thinking more in a horizontal compass. I’ve created a separate discussion for that if you’re insterested Horizontal compass