mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 06:03:26 +02:00
timer fix for reset
This commit is contained in:
parent
510e253575
commit
a1fd867c09
2 changed files with 19 additions and 5 deletions
|
@ -25,6 +25,8 @@
|
|||
running: true
|
||||
});
|
||||
|
||||
var timeSinceLastMoved = 0;
|
||||
var RESET_TIME_THRESHOLD = 5;
|
||||
var RESET_POSITION = {
|
||||
x: 549.12,
|
||||
y: 495.555,
|
||||
|
@ -48,6 +50,17 @@
|
|||
this.update = function(deltaTime) {
|
||||
self.getUserData();
|
||||
self.properties = Entities.getEntityProperties(self.entityId);
|
||||
|
||||
timeSinceLastMoved += deltaTime;
|
||||
if (Vec3.length(self.properties.velocity) < 0.1) {
|
||||
if (timeSinceLastMoved > RESET_TIME_THRESHOLD) {
|
||||
self.reset();
|
||||
timeSinceLastMoved = 0;
|
||||
}
|
||||
} else {
|
||||
timeSinceLastMoved = 0;
|
||||
}
|
||||
|
||||
if (self.userData.grabKey && self.userData.grabKey.activated === true) {
|
||||
if (self.activated !== true) {
|
||||
Entities.editEntity(self.paintStream, {
|
||||
|
@ -62,7 +75,6 @@
|
|||
animationSettings: stopSetting
|
||||
});
|
||||
self.activated = false;
|
||||
self.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,9 +162,9 @@
|
|||
blue: randInt(190, 250)
|
||||
},
|
||||
dimensions: {
|
||||
x: 5,
|
||||
y: 5,
|
||||
z: 5
|
||||
x: 50,
|
||||
y: 50,
|
||||
z: 50
|
||||
},
|
||||
lifetime: 100
|
||||
});
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
var scriptURL = "https://hifi-public.s3.amazonaws.com/scripts/entityScripts/sprayPaintCan.js";
|
||||
//Just temporarily using my own bucket here so others can test the entity. Once PR is tested and merged, then the entity script will appear in its proper place in S3, and I wil switch it
|
||||
var scriptURL = "https://hifi-public.s3.amazonaws.com/eric/scripts/sprayPaintCan.js";
|
||||
// var scriptURL = "https://hifi-public.s3.amazonaws.com/scripts/entityScripts/sprayPaintCan.js";
|
||||
// var scriptURL = "file:////Users/ericlevin/hifi/examples/entityScripts/sprayPaintCan.js?=v1" + Math.random();
|
||||
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
|
||||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
||||
|
|
Loading…
Reference in a new issue