target script attached in reset spawner

This commit is contained in:
James B. Pollack 2016-06-07 14:43:23 -07:00
parent 6573b3c71e
commit c545f53c75
2 changed files with 4 additions and 5 deletions

View file

@ -32,8 +32,7 @@
_this.collisionWithEntity = function(myID, otherID, collisionInfo) { _this.collisionWithEntity = function(myID, otherID, collisionInfo) {
//we dont actually use any of the parameters above, since we don't really care what we collided with, or the details of the collision. //we dont actually use any of the parameters above, since we don't really care what we collided with, or the details of the collision.
print('JBP TARGET COLLISION') //5 seconds after a collision, upright the target. protect from multiple collisions in a short timespan with the 'shouldUntip' variable
//5 seconds after a collision, upright the target. protect from multiple collisions in a short timespan with the 'shouldUntip' variable
if (_this.shouldUntip) { if (_this.shouldUntip) {
//in Hifi, preface setTimeout with Script.setTimeout //in Hifi, preface setTimeout with Script.setTimeout
Script.setTimeout(function() { Script.setTimeout(function() {
@ -47,11 +46,10 @@
} }
_this.untip = function() { _this.untip = function() {
print('JBP SHOULD UNTIP')
var props = Entities.getEntityProperties(this.entityID); var props = Entities.getEntityProperties(this.entityID);
var rotation = Quat.safeEulerAngles(props.rotation) var rotation = Quat.safeEulerAngles(props.rotation)
if (rotation.x > 3 || rotation.x < -3 || rotation.z > 3 || rotation.z < -3) { if (rotation.x > 3 || rotation.x < -3 || rotation.z > 3 || rotation.z < -3) {
print('too much pitch or roll, fix it'); print('home target - too much pitch or roll, fix it');
//we zero out the velocity and angular velocity //we zero out the velocity and angular velocity
Entities.editEntity(_this.entityID, { Entities.editEntity(_this.entityID, {

View file

@ -563,7 +563,8 @@
reset: true reset: true
} }
}), }),
density:100, script: 'atp:/pingPongGun/target.js',
density: 100,
dynamic: true dynamic: true
} }
var target = Entities.addEntity(targetProperties); var target = Entities.addEntity(targetProperties);