cursorVisual.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. this.createVisual = function () {
  2. let parent = this.parent;
  3. let p1 = [{"x":0,"y":0,"z":-0.1},{"x":0,"y":0,"z":-0.2}]
  4. let visNode = {
  5. "extends": "proxy/aframe/aentity.vwf",
  6. "properties": {},
  7. "children": {
  8. "cone":{
  9. "extends": "proxy/aframe/acone.vwf",
  10. "properties":{
  11. "height": 0.2,
  12. "radius-bottom": 0.01,
  13. "radius-top": 0.001,
  14. "rotation": [-90, 0, 0],
  15. "position": [0, 0, -0.1]
  16. },
  17. "children": {
  18. "material": {
  19. "extends": "proxy/aframe/aMaterialComponent.vwf",
  20. "type": "component",
  21. "properties":{
  22. "color": this.color,
  23. "transparent": true,
  24. "opacity": 0.6
  25. }
  26. },
  27. "aabb-collider": {
  28. "extends": "proxy/aframe/aabb-collider-component.vwf",
  29. "type": "component",
  30. "properties": {
  31. debug: false,
  32. interval: 10,
  33. objects: ".hit"
  34. }
  35. }
  36. }
  37. },
  38. "p1": {
  39. "extends": "proxy/aframe/aentity.vwf",
  40. "children": {
  41. "linepath": {
  42. "extends": "proxy/aframe/linepath.vwf",
  43. "properties": {
  44. "color": this.color,
  45. "path": p1,
  46. "width": 0.08, //this.width
  47. "taper": true,
  48. "transparent": true,
  49. "opacity": 0.6
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
  56. this.children.create("visualNode", visNode);
  57. }
  58. this.end_set = function (value) {
  59. this.end = this.translationFromValue(value);
  60. this.visualNode.p1.linepath.path = [this.visualNode.p1.linepath.path[0], this.end];
  61. }
  62. this.end_get = function () {
  63. return this.end;
  64. }
  65. this.color_set = function (value) {
  66. //this.avatarColor = value;
  67. this.color = value;
  68. if(this.visualNode){
  69. this.visualNode.p1.linepath.color = value;
  70. this.visualNode.cone.material.color = value;
  71. }
  72. }
  73. this.color_get = function () {
  74. return this.color;
  75. }