avatar.vwf.yaml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # avatar
  2. # Copyright 2017 Krestianstvo.org project
  3. ---
  4. extends: http://vwf.example.com/aframe/aentity.vwf
  5. type: "avatar"
  6. properties:
  7. methods:
  8. createAvatarBody:
  9. body: |
  10. let myColor = this.getRandomColor();
  11. var newNode =
  12. {
  13. "extends": "http://vwf.example.com/aframe/abox.vwf",
  14. "properties": {
  15. "color": myColor,
  16. "position": [0,0,0.5]
  17. },
  18. "children": {
  19. "avatarNameNode": {
  20. "extends": "http://vwf.example.com/aframe/atext.vwf",
  21. "properties": {
  22. "color": myColor,
  23. "value": this.id,
  24. "side": "double",
  25. "rotation": [0, 180, 0],
  26. "position": [0, 1, 0.5]
  27. }
  28. }
  29. }
  30. }
  31. //let cursor =
  32. //{
  33. // "id": 'cursor-' + this.id,
  34. // "extends": "http://vwf.example.com/aframe/acursor.vwf",
  35. //}
  36. let cursorVis =
  37. {
  38. "extends": "http://vwf.example.com/aframe/abox.vwf",
  39. "properties": {
  40. "color": myColor,
  41. "opacity": 0.3,
  42. "transparent": true,
  43. "depth": 3,
  44. "width": 0.02,
  45. "height": 0.02,
  46. "rotation": [0, 180, 0],
  47. "position": [0, 0, -2]
  48. }
  49. }
  50. let camera =
  51. {
  52. "id": 'camera-' + this.id,
  53. "extends": "http://vwf.example.com/aframe/acamera.vwf",
  54. "properties": {
  55. "look-controls-enabled": false,
  56. "wasd-controls": false,
  57. "userHeight": 0,
  58. }
  59. }
  60. this.interpolation = "50ms";
  61. this.children.create( "avatarBody", newNode );
  62. this.children.create( "avatarCursor", cursorVis );
  63. this.children.create( "avatarCamera", camera );
  64. getRandomColor:
  65. body: |
  66. var letters = '0123456789ABCDEF';
  67. var color = '#';
  68. for (var i = 0; i < 6; i++) {
  69. color += letters[Math.floor(this.random() * 16)]; }
  70. return color;