Giter Club home page Giter Club logo

assembly's Introduction

Assembly

Assembly is a small engine for positioning pieces of something in 3D space. It allows you to specify the "components" involved and the links between them, then renders the scene in the element of your choice. Controls are available for mouse and keyboard, touch, and WebVR.

TODO: one glaring omission right now - components are not shuffled from their original correct positions.

To use Assembly in your app first npm install assembly-app then

import { App, Assembly } from 'assembly-app'
const app = new App(domElement)
app.load(Assembly.create(obj, config))
app.start()

See Scene Configuration for more on Assembly.create.

Build

Set the ASSEMBLY_DEBUG environment variable to build in debug mode. Bodies are rendered in wireframe and link distance is visible.

npm install
npx webpack
python -m SimpleHTTPServer 8080 # or whatever
open http://localhost:8080/docs/dev.html

Test

npm run test
open http://localhost:9876

Scene Configuration

Assembly.create(obj, config) accepts two arguments to build the scene: the geometry definition and a sidecar configuration object. See dist/examples for samples.

obj: String

Wavefront OBJ definition of geometry. Objects must be uniquely named. Objects should be positioned so the assembly is complete and each component is in the desired position.

Define geometry for both the rendered scene and physics rigid bodies, the configuration object will define each object's role.

Geometry units are meters and scale is important for convincing VR experience. Objects are rendered Z up and Y forward. In hindsight this is nonstandard and was a poor decision.

config: Object

The configuration defines relationships and roles of geometry, using the object name as defined by o [object name] in the OBJ definition to reference geometry. The object must have the following attributes.

components: Object

Components are repositioned by the user to complete the assembly.

The keys of the components object are the names referenced by links. The values of the components object must be objects with the following attributes.

meshes: String[]

Names of geometry objects that will be rendered in the scene to represent this component. Unless also included in bodies, these objects will have no effect on collisions between components and fixtures.

bodies: String[]

Names of geometry objects that will be added to the physics world as rigid bodies. These objects are not rendered.

Rigid body geometry must be a box. If the box shape cannot be determined, geometry bounding box is used.

fixtures: Object

Fixtures are static. They can be linked to components but cannot be repositioned.

The fixtures object must take the same shape as components.

links: String[][]

Define placement of component relative to fixture or other component. Each link must be an array of two object names defined by the keys of components or fixtures.

assembly's People

Contributors

christianprescott avatar

Watchers

James Cloos avatar  avatar

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.