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

240
Visualizações
How to rotate an object by genericTweenValue in Lens Studio

I have an object that I want to rotate on the y-axis by 90 degrees every time I tap on the screen, and I would like to use the easing functions from the tween manager using genericTweenValue. In the code below I try to do that but the angles seem to be wrong.

Expected outcome: Object rotates by an angle of 90 degrees on each tap. Actual outcome: Makes multiple rotations on each tap, that are not 90 degrees.

global.turn = function() {
    var updateEvent = script.createEvent("UpdateEvent");

    var transform = object.getTransform();
    var rotation = transform.getLocalRotation();

    tweenManager.setStartValue(object, "y_rot_", rotation.y);
    tweenManager.setEndValue(object, "y_rot_", rotation.y + 90);

    updateEvent.bind(function(eventData) {
        var rotY = tweenManager.getGenericTweenValue(object, "y_rot_");
        var rotationToApply = quat.angleAxis(rotY, vec3.up());
        var oldRotation = object.getTransform().getLocalRotation();
        var newRotation = rotationToApply.multiply(oldRotation);
        transform.setLocalRotation(newRotation);
    });

    tweenManager.startTween(object, "y_rot_", function() {
        script.removeEvent(updateEvent);
    });
}

var touchEvent = script.createEvent("TapEvent");
touchEvent.bind(function(eventData) {global.turn()});
about 4 years ago · Juan Pablo Isaza
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