1.0.1 • Published 7 years ago

aframe-network-component v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

aframe-network-component

Synchronizes transforms across the network

For A-Frame.

API

PropertyDescriptionDefault Value

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.slim.js"></script>
  <script src="https://unpkg.com/aframe-network-component@1.0.0/index.js"></script>
</head>

<body>
  <a-scene>
    <a-entity id="player" camera wasd-controls look-controls position="0 0.5 0.5" network="local: true"></a-entity>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-network-component

Then require and use.

require('aframe');
require('aframe-network-component');

Getting started

If you've just checked out the repository, and want to try things out, here's some quick steps to get started.

Install dependencies

npm install

Build client files

npm run-script build

Launch the browser

npm start

At this point, click on the Basic link, and you should see a basic scene. You can move with the cursor keys.

Start the server

In a different window, you'll want to launch the server.

node server/network-server.js

Overview

Basically, the node server just listens for incoming messages, and relays data to all the connected clients. The clients send the server properties for their player avatar (which is just a cube).