Skip to content

Commit

Permalink
log2hud now shows rotation in radians (default object3D behaviour) in…
Browse files Browse the repository at this point in the history
…stead of degrees
  • Loading branch information
ctrlw committed Jun 30, 2024
1 parent a937972 commit a1c2921
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions log2hud.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ AFRAME.registerComponent('log2hud', {
},

tick: function () {
var rotation = this.el.getAttribute('rotation');
var pos = this.el.getAttribute('position');
// var rotation = this.el.getAttribute('rotation'); // angle in degrees
var rotation = this.el.object3D.rotation; // angle in radians
var pos = this.el.object3D.position; // (relative) position in meters
var s = "pos: " + this.toString(pos) + "\nrot: " + this.toString(rotation);
// console.log(s);
this.hud.setAttribute('text', 'value: ' + s);
Expand Down

0 comments on commit a1c2921

Please sign in to comment.