cursorVisual.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. }
  28. },
  29. "p1": {
  30. "extends": "proxy/aframe/aentity.vwf",
  31. "children": {
  32. "linepath": {
  33. "extends": "proxy/aframe/linepath.vwf",
  34. "properties": {
  35. "color": this.color,
  36. "path": p1,
  37. "width": 0.08, //this.width
  38. "taper": true,
  39. "transparent": true,
  40. "opacity": 0.6
  41. }
  42. }
  43. }
  44. }
  45. }
  46. }
  47. this.children.create("visualNode", visNode);
  48. }
  49. this.end_set = function (value) {
  50. this.end = this.translationFromValue(value);
  51. this.visualNode.p1.linepath.path = [this.visualNode.p1.linepath.path[0], this.end];
  52. }
  53. this.end_get = function () {
  54. return this.end;
  55. }
  56. this.color_set = function (value) {
  57. //this.avatarColor = value;
  58. this.color = value;
  59. if(this.visualNode){
  60. this.visualNode.p1.linepath.color = value;
  61. this.visualNode.cone.material.color = value;
  62. }
  63. }
  64. this.color_get = function () {
  65. return this.color;
  66. }