Nikolay Suslov il y a 7 ans
Parent
commit
f84a6bb810

+ 21 - 0
support/client/lib/vwf/model/aframe.js

@@ -268,6 +268,27 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
         },
 
 
+        // -- callingMethod ------------------------------------------------------------------------
+
+        callingMethod: function( nodeID, methodName, methodParameters ) {
+
+            var node = this.state.nodes[nodeID];
+
+            if(!node) return;
+
+            if (node && node.aframeObj ) {
+                if (methodName == 'lookAt') {
+                    console.log('lookAt: ' +  methodParameters[0]);
+                    let target = methodParameters[0];
+                    node.aframeObj.object3D.lookAt(new THREE.Vector3(target.x, target.y, target.z));
+                    let newRotation = node.aframeObj.getAttribute('rotation');
+                    self.kernel.setProperty(nodeID, "rotation", {x: 0, y: newRotation.y, z: 0});
+                }
+            }
+
+           
+        },
+
 
         // -- deletingNode -------------------------------------------------------------------------
 

+ 4 - 4
support/client/lib/vwf/view/lib/editorLive.css

@@ -178,12 +178,12 @@
 
       }
 
-      .prop-mdc-text-field {
-         /*
+     /*  .prop-mdc-text-field {
+        
         height: 56px;
-        */
+       
       }
-
+ */
 
       .mdc-list-item__graphic {
         margin-left: 0;

+ 3 - 0
support/proxy/vwf.example.com/aframe/aentity.vwf.yaml

@@ -20,5 +20,8 @@ methods:
   updateSrc:
     parameters:
       - src
+  lookAt:
+    parameters:
+      - nodeID
 scripts:
   - source: "http://vwf.example.com/aframe/aentity.js"

+ 7 - 1
support/proxy/vwf.example.com/aframe/ascene.js

@@ -296,9 +296,15 @@ this.createPrimitive = function (type, avatar, params, name, node) {
             break;
     }
 
+    var self = this;
+
     if (newNode) {
         newNode.properties.position = position;
-        this.children.create(nodeName, newNode);
+        this.children.create(nodeName, newNode, function( child ) {
+           // self.select( self.clickedID );
+           child.lookAt(this.children[avatar].worldPosition)
+           //console.log(avatar);
+          });
     }
 
 }