Let the player part the grass, and make the wind gust
Updated
Balls roll down a meadow and part the grass with their Grass Benders, as in the runtime Sky & Terrain demo; the script gives the camera a bender of its own and makes the wind gust every few seconds.
Watch the balls roll down the hill and push the grass aside, and the meadow sway harder when a gust comes. Drag to orbit the camera, scroll to zoom.
Let the player part the grass, and make the wind gust
#pragma lifecycle(startup)
async function startup() { const player = findEntity('Main Camera'); if (!player.getComponent(GrassBenderComponent)) { player.addComponent(new GrassBenderComponent({ radius: 0.5, strength: 1.2, offsetY: -1.5 })); }
const grass = findEntity('Terrain').getComponent(GrassComponent);
for (;;) { await new Promise((done) => delay(done, Random.range(4000, 9000))); const gust = Tween.value(0.5, 1.6, (w) => grass.setProps({ windStrength: w }), { duration: 1.2, ease: Ease.InOutSine, yoyo: true, repeat: 1, }); if (!(await gust)) return; }}How it works
Section titled “How it works”The script is explained step by step in Let the player part the grass, and make the wind gust.
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.
GrassFeel.xrproj