From aed5629ecaf078672296987d9d0af78ce03deec2 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 18 Nov 2015 12:50:42 -0800 Subject: [PATCH] equipping --- examples/controllers/handControllerGrab.js | 3 ++- examples/weapons/pistol/pistol.js | 3 +++ examples/weapons/pistol/pistolSpawner.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index ec7a38e697..0bf8693391 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -773,7 +773,7 @@ function MyController(hand) { this.setState(STATE_CONTINUE_NEAR_GRABBING); } else { // equipping - Entities.callEntityMethod(this.grabbedEntity, "startEquip"); + Entities.callEntityMethod(this.grabbedEntity, "equip", [JSON.stringify(this.hand)]); this.setState(STATE_CONTINUE_EQUIP_BD); } @@ -808,6 +808,7 @@ function MyController(hand) { } if (this.state == STATE_CONTINUE_NEAR_GRABBING && this.bumperSqueezed()) { this.setState(STATE_CONTINUE_EQUIP_BD); + Entities.callEntityMethod(this.grabbedEntity, "equip", [JSON.stringify(this.hand)]); return; } diff --git a/examples/weapons/pistol/pistol.js b/examples/weapons/pistol/pistol.js index 2d844340d3..63fb3c4006 100644 --- a/examples/weapons/pistol/pistol.js +++ b/examples/weapons/pistol/pistol.js @@ -24,6 +24,8 @@ equip: function() { this.equipped = true; + print("EQUIP") + }, unequip: function() { this.equipped = true; @@ -36,5 +38,6 @@ }; // entity scripts always need to return a newly constructed object of our type + print("TOOOss") return new Pistol(); }); \ No newline at end of file diff --git a/examples/weapons/pistol/pistolSpawner.js b/examples/weapons/pistol/pistolSpawner.js index 465c086750..6e28ddb6c6 100644 --- a/examples/weapons/pistol/pistolSpawner.js +++ b/examples/weapons/pistol/pistolSpawner.js @@ -1,6 +1,7 @@ -var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); +var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation()))); var scriptURL = Script.resolvePath('pistol.js'); var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx"; +print("SJDJDJ") var pistol = Entities.addEntity({ type: 'Model',