A library for using Altspace's native components.
In-depth reference for each native component
All config options below are the default values.
res: 'architecture/wall-4w-4h'
var config = { res: 'effects/explosion' };
var explosion = new NativeComponent('n-object', config).addTo(scene);
isTrigger: false
center: { 'x': 0, 'y': 0, 'x': 0 }
size: { 'x': 0, 'y': 0, 'x': 0 }
type: 'environment'
var geometry = new THREE.BoxGeometry(5, 5, 5);
var material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
var testBox = new THREE.Mesh(geometry, material);
testBox.position.set(-10, 0, 0);
var config = { size: { 'x': 3, 'y': 3, 'x': 3 } };
var testBoxCollider = new NativeComponent('n-box-collider', config, testBox).addTo(scene);
isTrigger: false
center: { 'x': 0, 'y': 0, 'x': 0 }
radius: 0
type: 'environment'
var geometry = new THREE.SphereGeometry(3, 20, 20);
var material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
var testSphere = new THREE.Mesh(geometry, material);
testSphere.position.set(-10, 0, 10);
var config = { radius: 3 };
var testSphereCollider = new NativeComponent('n-sphere-collider', config, testSphere).addTo(scene);
isTrigger: false
center: { 'x': 0, 'y': 0, 'x': 0 }
radius: 0
height: 0
direction: 'y'
type: 'environment'
res: [string]
var testSpawner = new NativeComponent('n-spawner').addTo(scene, function(obj) {
obj.position.set(5, 0, 0);
});
isTrigger: false
convex: true
type: 'environment'
part: 'head'
side: 'center'
index: 0
userId: null
var geometry = new THREE.CubeGeometry(0.5, 0.5, 0.5);
var material = new THREE.MeshBasicMaterial({ color: 0xff0000, opacity: 0.7, transparent: true });
var objSkelParent = new THREE.Mesh(geometry, material);
objSkelParent.position.set(0, 0.5, 0);
var config = { part: 'head' };
var testSkeletonParent = new NativeComponent('n-skeleton-parent', config, objSkelParent).addTo(scene);
must pass null
var geometry = new THREE.PlaneGeometry(0.08, 0.08);
var material = new THREE.MeshBasicMaterial({ color: 0xff0000, opacity: 0.7, transparent: true });
var objCockpitParent = new THREE.Mesh(geometry, material);
objCockpitParent.position.set(0.1, 0, -1);
var testCockpitParent = new NativeComponent('n-cockpit-parent', null, objCockpitParent).addTo(scene);
capacity: 4
text: ''
fontSize: 10
width: 10
height: 1
horizontalAlign: 'middle'
verticalAlign: 'middle'
var config = { fontSize: 10, horizontalAlign: 'middle' };
var testText = new NativeComponent('n-text', config).addTo(scene);
must pass null
var geometry = new THREE.PlaneGeometry(5, 5);
var material = new THREE.MeshBasicMaterial({ color: 0xffff00 });
var testPlane = new THREE.Mesh(geometry, material);
testPlane.position.set(-10, 0, 20);
var testBillboard = new NativeComponent('n-billboard', null, testPlane).addTo(scene);
on: ''
res: ''
src: ''
loop: false
volume: 1
autoplay: false
oneshot: false
spatialBlend: 1
pitch: 1
minDistance: 1
maxDistance: 12
var audioFile = 'test.mp3';
var config = {
autoplay: true,
loop: false,
src: 'audio/' + audioFile,
volume: 0.5,
minDistance: 50,
maxDistance: 200
};
var testSound = new NativeComponent('n-sound', config).addTo(scene);
var testSoundCalls = function () {
testSound.call('pause');
testSound.call('seek', {time: 0});
testSound.call('play');
};
setInterval(testSoundCalls, 5000);