equipping

This commit is contained in:
ericrius1 2015-11-18 12:50:42 -08:00
parent 47c2119888
commit aed5629eca
3 changed files with 7 additions and 2 deletions

View file

@ -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;
}

View file

@ -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();
});

View file

@ -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',