Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
import * as THREE from 'three';
const mouse = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
class Selector {
constructor( editor ) {
const signals = editor.signals;
this.editor = editor;
this.signals = signals;
// signals
signals.intersectionsDetected.add( ( intersects ) => {
if ( intersects.length > 0 ) {
// Resolve helpers to their actual objects
const objects = [];
for ( let i = 0; i < intersects.length; i ++ ) {
let object = intersects[ i ].object;
if ( object.userData.object !== undefined ) {
object = object.userData.object;
}
if ( objects.indexOf( object ) === - 1 ) {
objects.push( object );
}
}
// Cycle through objects if the first one is already selected
const index = objects.indexOf( editor.selected );
if ( index !== - 1 && index < objects.length - 1 ) {
this.select( objects[ index + 1 ] );
} else {
this.select( objects[ 0 ] );
}
} else {
this.select( null );
}
} );
}
getIntersects( raycaster ) {
const objects = [];
this.editor.scene.traverseVisible( function ( child ) {
objects.push( child );
} );
this.editor.sceneHelpers.traverseVisible( function ( child ) {
if ( child.name === 'picker' ) objects.push( child );
} );
return raycaster.intersectObjects( objects, false );
}
getPointerIntersects( point, camera ) {
mouse.set( ( point.x * 2 ) - 1, - ( point.y * 2 ) + 1 );
raycaster.setFromCamera( mouse, camera );
return this.getIntersects( raycaster );
}
select( object ) {
if ( this.editor.selected === object ) return;
let uuid = null;
if ( object !== null ) {
uuid = object.uuid;
}
this.editor.selected = object;
this.editor.config.setKey( 'selected', uuid );
this.signals.objectSelected.dispatch( object );
}
deselect() {
this.select( null );
}
}
export { Selector };