bow collisions, etc

This commit is contained in:
James B. Pollack 2015-11-23 12:36:39 -08:00
parent aa2450d755
commit c22a07bba7

View file

@ -270,8 +270,13 @@
}); });
Script.addEventHandler(arrow, "collisionWithEntity", function(entityA, entityB, collision) { var makeArrowStick = function(entityA, entityB, collision) {
Entities.editEntity(entityA, { Entities.editEntity(entityA, {
angularVelocity: {
x: 0,
y: 0,
z: 0
},
velocity: { velocity: {
x: 0, x: 0,
y: 0, y: 0,
@ -282,10 +287,14 @@
y: 0, y: 0,
z: 0 z: 0
}, },
position: collision.contactPoint,
collisionsWillMove: false collisionsWillMove: false
}) })
print('ARROW COLLIDED WITH::' + entityB); print('ARROW COLLIDED WITH::' + entityB);
}); Script.removeEventHandler(arrow, "collisionWithEntity", makeArrowStick)
}
Script.addEventHandler(arrow, "collisionWithEntity", makeArrowStick);
return arrow return arrow
}, },
@ -549,6 +558,7 @@
//make the arrow physical, give it gravity, a lifetime, and set our velocity //make the arrow physical, give it gravity, a lifetime, and set our velocity
var arrowProperties = { var arrowProperties = {
collisionsWillMove: true, collisionsWillMove: true,
ignoreForCollisions:false,
velocity: releaseVelocity, velocity: releaseVelocity,
gravity: ARROW_GRAVITY, gravity: ARROW_GRAVITY,
lifetime: 10, lifetime: 10,