Script: Uplift

Uplift picture
Type
Typescript logo indicatortypescript
Date Created
Aug 23, 2024, 12:43:19 PM
Last Edit Date
Jan 8, 2026, 6:51:20 PM

Project Information

The authors of this Gaussian splatting 3D scan are Christie Lau and Edmund Fraser.

View Full Project

Script Code

let pulseFactor = 0;
const minPulse = -0.1;
const maxPulse = 0.2;
let stepPulse = 0.0003;

const start = async () => {

    const scene = bitbybit.babylon.scene.getScene();

    const camera = bitbybit.babylon.scene.getActiveCamera() as BABYLON.ArcRotateCamera;
    camera.target = new BABYLON.Vector3(0, 1, 0);
    camera.alpha = -2;
    camera.beta = 2.5;
    camera.radius = 4.4;
    camera.panningSensibility = 0;
    camera.angularSensibilityX = 3000;
    camera.angularSensibilityY = 3000;
    camera.maxZ = 100;
    camera.wheelPrecision = 40;
    camera.lowerBetaLimit = 1;
    camera.upperBetaLimit = 1.57;
    camera.lowerAlphaLimit = -2.2;
    camera.upperAlphaLimit = 0.5;
    camera.lowerRadiusLimit = 2;
    camera.upperRadiusLimit = 5;

    scene.activeCamera = camera;
    bitbybit.babylon.scene.backgroundColour({
        colour: "#211f1b"
    });
    bitbybit.babylon.gaussianSplatting.create({
        url: "https://bitbybit.dev/files/users%2FyVqNAFXmieX0iAkdP6wAz5BJ4X82%2Fprojects%2FbazadnDTAr0ckKY0FKdV%2Fassets%2Fground-dancers.splat?alt=media&token=a3b9cc60-556f-49b0-b003-5e775303724d"
    });
    const airDancer = await bitbybit.babylon.gaussianSplatting.create({
        url: "https://bitbybit.dev/files/users%2FyVqNAFXmieX0iAkdP6wAz5BJ4X82%2Fprojects%2FbazadnDTAr0ckKY0FKdV%2Fassets%2Fair-dancer.splat?alt=media&token=7d5c9e03-6d94-46fe-8568-4fe1ed609ad3"
    });
    bitbybit.time.registerRenderFunction(() => {

        if (pulseFactor < maxPulse && pulseFactor > minPulse) {
            pulseFactor += stepPulse;
        }
        if (pulseFactor < minPulse || pulseFactor > maxPulse) {
            stepPulse *= -1;
            pulseFactor += stepPulse;
        };
        airDancer.position.y = pulseFactor;
        airDancer.rotation.y = pulseFactor * 2;

    });
}

start();