mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 07:22:43 +02:00
add identifyEntity() to butterflies script
This commit is contained in:
parent
497fbade9b
commit
0f5930a43d
1 changed files with 3 additions and 0 deletions
|
@ -103,6 +103,9 @@ function updateButterflies(deltaTime) {
|
|||
var CHANCE_OF_IMPULSE = 0.04;
|
||||
for (var i = 0; i < numButterflies; i++) {
|
||||
if (Math.random() < CHANCE_OF_IMPULSE) {
|
||||
if (!butterflies[i].isKnownID) {
|
||||
butterflies[i] = Entities.identifyEntity(butterflies[i]);
|
||||
}
|
||||
var properties = Entities.getEntityProperties(butterflies[i]);
|
||||
if (Vec3.length(Vec3.subtract(properties.position, flockPosition)) > range) {
|
||||
Entities.editEntity(butterflies[i], { position: flockPosition } );
|
||||
|
|
Loading…
Reference in a new issue