Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda