Hear a Transform move
Updated
A script adds a filtered Signal Emitter to a crate, then moves it twice: setPosition reports a Transform event, a direct write to position does not.
Read the script log: one line for the setPosition call, none for the direct write.
Hear a Transform move
#pragma lifecycle(startup)
function startup() { const crate = findEntity('Crate'); if (!crate) return;
crate.addComponent(new SignalEmitterComponent({ signal: 'crate/moved', eventFilter: ['Transform::position-change'], }));
on('crate/moved', (event) => { const p = event.data.position; log('Crate now at', p.x.toFixed(2), p.y.toFixed(2), p.z.toFixed(2)); });
crate.setPosition(1, 0.5, -2); // sends an event crate.position.x += 1; // a direct write: sends nothing}How it works
Section titled “How it works”The script is explained step by step in Hear a Transform move.
Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
TransformEcho.xrproj