playMaker

Author Topic: [SOLVED] Compass  (Read 3319 times)

santelia

  • Junior Playmaker
  • **
  • Posts: 78
[SOLVED] Compass
« on: June 03, 2012, 04:11:46 AM »
I have to display the direction of the camera using a simple compass parented to the camera itself in one corner of the screen. Which action would you suggest to use to get the camera direction? And which one to direct the compass needle?
« Last Edit: June 06, 2012, 05:13:39 PM by Alex Chouls »

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Compass
« Reply #1 on: June 03, 2012, 01:25:53 PM »
my personal favorite would be the position of the one minus the position of the other and then smooth look at direction. Then something like Inverse transform direction and then set vector xyz to constrain it to a local 2 axis (send one axis to 0) .
Can be done a lot easier though :D But that's the general drift.


Sorry, I read it again, just  get the world rotation of the camera and set it as local rotation on the needle, set vector xyz to y = 0 to make it spin on 2 axis only. All of these every frame.
« Last Edit: June 03, 2012, 01:28:46 PM by kiriri »
Best,
Sven

santelia

  • Junior Playmaker
  • **
  • Posts: 78
Re: Compass
« Reply #2 on: June 06, 2012, 04:03:56 PM »
Since the child object of the camera needed to much tuning to be anchored where I wanted it to be, I switched to a GUI element. So, as kirikiri suggested, got the world rotation of the camera on axis Y. But instead of using it for vectors of a 3d object, I used its value with set rotation along Y axis of a compass gui texure inside the tool bar of the game.