Rotating a plane with device rotation

Options
Şener
Şener Posts: 1
edited March 11 in Programming #1

So, I want to rotate a plane only on y-axis with the device's y-axis rotation.

`

// @input Component.DeviceTracking device

// @input SceneObject plane

const deviceTransform = script.device.getTransform();
const planeTransform = script.plane.getTransform();

script.createEvent("UpdateEvent").bind(() => {
let deviceY = deviceTransform.getWorldRotation().toEulerAngles().y;

let planeRotation = planeTransform.getWorldRotation().toEulerAngles();

planeTransform.setWorldRotation(quat.fromEulerAngles(planeRotation.x, deviceY, planeRotation.z))

})

`

This is the code I am using. But it makes a weird jump after an angle.