Teresa Moontyners – The compass, logic and display method

Implementing the compass for my inexperience, it was quite problematic, but in the end I managed to get a result that satisfies me.
I start by modelling 2 objects; the compass case and the pointer, I need them separate because the pointer must be inside the case and move with it, but its rotation must be independent.

For the in-game display of the compass, I thought of doing the following:
when the player clicks on the compass icon, Teresa stops and performs the animation of pulling it out and looking at it, and at the same time the image of the compass with the pointer rotating towards north appears on the lower part of the screen, clicking again on the compass icon, Teresa will perform the animation of putting the object away, returning to the idle animation ready for the next input.
For the logic of the compass operation I reasoned in this way:
during the moments when the compass is active, I take the rotation on the vertical axis of Teresa, this is also the rotation of the compass case; while the pointer acquires the rotation from another object that is not seen in the game, which I called “north point”, in this way the pointer will always point in the direction that I have set the object “north point”, while the case of the compass will have the rotation of the player, some tricks on the camera that frames the compass so that it displays the stationary case (because it actually rotates the same degrees of rotation of the player), and instead leave the freedom to the pointer to indicate the correct point.
In this way, looking at the compass I will have the exact position of the north point, which I can decide from scene to scene by simply changing the rotation of the object that is not seen as the “north point”.

Leave a Reply

Your email address will not be published. Required fields are marked *