Git Product home page Git Product logo

altspacevr-native-components-js's Introduction

AltspaceVR Native Components JS

A library for using Altspace's native components.

Components

Native resources

In-depth reference for each native component

All config options below are the default values.


n-object

config

      res: 'architecture/wall-4w-4h'

example

var config = { res: 'effects/explosion' };
var explosion = new NativeComponent('n-object', config).addTo(scene);

n-box-collider

config

      isTrigger: false
      center: { 'x': 0, 'y': 0, 'x': 0 }
      size: { 'x': 0, 'y': 0, 'x': 0 }
      type: 'environment'

example

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);

n-sphere-collider

config

      isTrigger: false
      center: { 'x': 0, 'y': 0, 'x': 0 }
      radius: 0
      type: 'environment'

example

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);
          

n-capsule-collider

config

      isTrigger: false
      center: { 'x': 0, 'y': 0, 'x': 0 }
      radius: 0
      height: 0
      direction: 'y'
      type: 'environment'

example


n-spawner

config

      res: [string]

example

var testSpawner = new NativeComponent('n-spawner').addTo(scene, function(obj) {
  obj.position.set(5, 0, 0);
});
          

n-mesh-collider

config

      isTrigger: false
      convex: true
      type: 'environment'

example


n-skeleton-parent

config

      part: 'head'
      side: 'center'
      index: 0
      userId: null

example

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);

n-cockpit-parent

config

      must pass null

example

  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);
          

n-container

config

      capacity: 4

example


n-text

config

      text: ''
      fontSize: 10
      width: 10
      height: 1
      horizontalAlign: 'middle'
      verticalAlign: 'middle'

example

var config = { fontSize: 10, horizontalAlign: 'middle' };
var testText = new NativeComponent('n-text', config).addTo(scene);

n-billboard

config

      must pass null

example

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);

n-sound

config

      on: ''
      res: ''
      src: ''
      loop: false
      volume: 1
      autoplay: false
      oneshot: false
      spatialBlend: 1
      pitch: 1
      minDistance: 1
      maxDistance: 12

example

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);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.