Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

77
Visualizações
convert 24 hour time into rotational value

ok, so a bit of an odd question, I have implemented a real-time system using Date() and Date.getTime(), And I have a plugin installed on my project (mz3d), I know how to use it, however I have run into a problem with the sun,

I need to convert 24 hour time from getTime() into a rotational value for mz3d's sun. however, the sun's topmost position in the sky is at 0 degrees and beneath the floor is 180 degrees.

my code is:

//variables
var d = new Date();
var hr= d.getHours();
var mn= d.getMinutes();
//conversion
var sun;
//mz3d command
mz3d.command('sun pitch',sun,0);

how would I calculate it so 12 to is 0 degrees and 24 or 0 is 180 degrees?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Thanks to RobG i found the following code works

var d = new Date();
minSinceMidnight = d.getTime()- d.setHours(
    0, 0, 0, 0
);
minSinceMidnight = Math.round(
    minSinceMidnight / 60000
);
var math1 = minSinceMidnight/1440;
var math2 = math1*360
//console.log(d);
//console.log(minSinceMidnight);
//console.log(math2);
var sun = math2+180
//console.log(
//    "sun pos = ", sun
//);
mz3d.command('sun pitch',sun,0);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda