cursorVisual.js 2.1 KB

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