123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- this.simpleDef = {
- "extends": "http://vwf.example.com/aframe/abox.vwf",
- children: {
- "material": {
- "extends": "http://vwf.example.com/aframe/aMaterialComponent.vwf",
- "type": "component",
- "properties":{
- "color": "white"
- }
- }
- },
- "properties": {
- "position": "0 0 0",
- "height": 0.01,
- "width": 0.01,
- "depth": 1
- },
- children: {
- "pointer": {
- "extends": "http://vwf.example.com/aframe/abox.vwf",
- "properties": {
- "position": "0 0 -0.8",
- "height": 0.1,
- "width": 0.1,
- "depth": 0.1
- },
- children: {
- "material": {
- "extends": "http://vwf.example.com/aframe/aMaterialComponent.vwf",
- "type": "component",
- "properties":{
- "color": "green"
- }
- }
- // "rotationText": {
- // "extends": "http://vwf.example.com/aframe/atext.vwf",
- // "properties":{
- // "value": "rot",
- // "side": "double",
- // }
- // }
- }
- }
-
- }
- }
- this.modelDef = {
- "extends": "http://vwf.example.com/aframe/agltfmodel.vwf",
- "properties": {
- "src": "#gearvr",
- "position": "0 0 0",
- "rotation": "0 180 0"
- },
- "children": {
- "animation-mixer": {
- "extends": "http://vwf.example.com/aframe/anim-mixer-component.vwf",
- "properties": {
- "clip": "*",
- "duration": 1
- }
- }
- }
- }
- this.createController = function (modelSrc) {
- let controllerDef = this.simpleDef;
- var newNode = {
- "extends": "http://vwf.example.com/aframe/aentity.vwf",
- "properties": {
- "position": [0, 0, 0]
- },
- children: {
- "controller": controllerDef
- }
- }
- if (modelSrc) {
- let controllerDef = this.modelDef;
- controllerDef.properties.src = modelSrc;
- newNode.children.controller = controllerDef;
- }
- let interpolation = {
- "extends": "http://vwf.example.com/aframe/interpolation-component.vwf",
- "type": "component",
- "properties": {
- "enabled": true
- }
- }
- this.children.create( "interpolation", interpolation );
- this.children.create("handVRNode", newNode);
- }
- this.updateVRControl = function(position, rotation){
-
- this.position = position;
- this.rotation = rotation;
- // this.handVRNode.controller.pointer.rotationText.value = rotation.x.toString() + rotation.y.toString() + rotation.z.toString();
- }
- this.createSimpleController = function(){
- if (this.handVRNode.controller) {
- this.handVRNode.children.delete(this.handVRNode.controller);
- let controllerDef = this.simpleDef;
- this.handVRNode.children.create("controller", controllerDef);
- }
- }
- this.createAvatarFromGLTF = function(modelSrc){
- if (this.handVRNode.controller) {
- this.handVRNode.children.delete(this.handVRNode.controller);
-
- let controllerDef = this.modelDef;
- controllerDef.properties.src = modelSrc;
- this.handVRNode.children.create("controller", controllerDef);
- }
- }
- this.initialize = function() {
- // this.future(0).update();
- }
- this.triggerdown = function() {
- this.handVRNode.controller.pointer.material.color = 'red'
- }
- this.triggerup = function() {
- this.handVRNode.controller.pointer.material.color = 'green'
- }
|