aentity.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. this.getChildByName = function(name){
  2. let nodes = this.children.filter(el=>el.displayName == name);
  3. return nodes[0]
  4. }
  5. this.setGizmoMode = function (mode) {
  6. if (this.gizmo) {
  7. this.gizmo.properties.mode = mode
  8. }
  9. }
  10. this.showCloseGizmo = function () {
  11. let gizmoNode =
  12. {
  13. "extends": "http://vwf.example.com/aframe/gizmoComponent.vwf",
  14. "type": "component",
  15. "properties":
  16. {
  17. "mode": "translate"
  18. }
  19. }
  20. if (this.properties.edit) {
  21. this.children.create("gizmo", gizmoNode);
  22. } else {
  23. if (this.gizmo) {
  24. this.children.delete(this.gizmo)
  25. }
  26. }
  27. }
  28. // Parse a parameter as a translation specification.
  29. this.translationFromValue = function( propertyValue ) {
  30. var value = goog.vec.Vec3.create();
  31. if (propertyValue.hasOwnProperty('x')) {
  32. value = goog.vec.Vec3.createFromValues(propertyValue.x, propertyValue.y, propertyValue.z)
  33. }
  34. else if (Array.isArray(propertyValue) || propertyValue instanceof Float32Array ) {
  35. value = goog.vec.Vec3.createFromArray(propertyValue);}
  36. else if (typeof propertyValue === 'string') {
  37. let val = AFRAME.utils.coordinates.parse(propertyValue);
  38. value = goog.vec.Vec3.createFromValues(val.x, val.y, val.z)
  39. }
  40. return value
  41. // return value && value.length >= 3 ?
  42. // value :
  43. // goog.vec.Vec3.create();
  44. };
  45. this.sendOSC = function(msg){
  46. //sending OSC msg
  47. vwf_view.kernel.fireEvent(this.id, "sendOSC", [msg]);
  48. // if (_OSCManager.port !== null) {
  49. // _OSCManager.port.send(msg);
  50. // }
  51. //on driver side
  52. }
  53. this.intersectEvent = function(){
  54. //this.intersectEventMethod();
  55. }
  56. this.clearIntersectEvent = function(){
  57. //this.clearIntersectEventMethod();
  58. }
  59. this.intersectEventMethod = function(){
  60. //intersect method
  61. }
  62. this.clearIntersectEventMethod = function(){
  63. //clearIntersect method
  64. }