123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- # avatar
- # Copyright 2017 Krestianstvo.org project
- ---
- extends: http://vwf.example.com/aframe/aentity.vwf
- type: "avatar"
- properties:
- methods:
- createAvatarBody:
- body: |
- let myColor = this.getRandomColor();
- var newNode =
- {
- "extends": "http://vwf.example.com/aframe/abox.vwf",
- "properties": {
- "color": myColor,
- "position": [0,0,0.5]
- },
- "children": {
- "avatarNameNode": {
- "extends": "http://vwf.example.com/aframe/atext.vwf",
- "properties": {
- "color": myColor,
- "value": this.id,
- "side": "double",
- "rotation": [0, 180, 0],
- "position": [0, 1, 0.5]
- }
- }
- }
- }
- //let cursor =
- //{
- // "id": 'cursor-' + this.id,
- // "extends": "http://vwf.example.com/aframe/acursor.vwf",
- //}
- let cursorVis =
- {
- "extends": "http://vwf.example.com/aframe/abox.vwf",
- "properties": {
- "color": myColor,
- "opacity": 0.3,
- "transparent": true,
- "depth": 3,
- "width": 0.02,
- "height": 0.02,
- "rotation": [0, 180, 0],
- "position": [0, 0, -2]
- }
- }
- let camera =
- {
- "id": 'camera-' + this.id,
- "extends": "http://vwf.example.com/aframe/acamera.vwf",
- "properties": {
- "look-controls-enabled": false,
- "wasd-controls": false,
- "userHeight": 0,
- }
- }
- this.interpolation = "50ms";
- this.children.create( "avatarBody", newNode );
- this.children.create( "avatarCursor", cursorVis );
- this.children.create( "avatarCamera", camera );
- getRandomColor:
- body: |
- var letters = '0123456789ABCDEF';
- var color = '#';
- for (var i = 0; i < 6; i++) {
- color += letters[Math.floor(this.random() * 16)]; }
- return color;
|