See which way surfaces face
Updated
Shapes coloured by the direction each surface faces, with a Normal material that needs no light; every three seconds the script switches them between smooth and flat shading.
Watch the colours follow each face as the shapes turn, and the switch between smooth and faceted shading. Drag to orbit the camera, scroll to zoom.
See which way surfaces face
#pragma lifecycle(startup, update)
const NAMES = ['Torus', 'Gem', 'Ball'];let shapes = [];let flat = false;let next = 3;
function startup() { shapes = NAMES.map((name) => findEntity(name)); log('Normal material on', shapes.length, 'shapes');}
function update(dt, time) { for (const [i, shape] of shapes.entries()) shape.rotation.set(time * 0.3, time * (0.5 + i * 0.1), 0); if (time < next) return; next = time + 3; flat = !flat; for (const shape of shapes) shape.getComponent(NormalMaterialComponent).setProps({ flatShading: flat }); log(flat ? 'Flat shading' : 'Smooth shading');}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.
NormalMaterialShapes.xrproj