32 lines
No EOL
1.1 KiB
JavaScript
32 lines
No EOL
1.1 KiB
JavaScript
//
|
|
// ballZone.js
|
|
//
|
|
// Created by Rebecca Stankus on 12/11/17.
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
// This script acts on the zone for the ball pit. It gives entities 0-gravity upon entering and restores the normal
|
|
// setting upon leaving.
|
|
//
|
|
|
|
var nearbyStuff = Entities.findEntities(MyAvatar.position, 100.0);
|
|
nearbyStuff.forEach(function(element) {
|
|
var properties = Entities.getEntityProperties(element);
|
|
if (properties.name.indexOf("Ball Pit Ball") !== -1) {
|
|
Entities.editEntity(element, {
|
|
linearVelocity:{x:10,y:10,z:10},
|
|
angularDamping:0,
|
|
damping:0,
|
|
angularVelocity:{x:10,y:10,z:10},
|
|
acceleration:{x:10,y:10,z:10},
|
|
dimensions:{x:0.4,y:0.4,z:0.4},
|
|
friction:0,
|
|
restitution:0.9,
|
|
position:{"x":49.03267288208008,"y":-12.252202033996582,"z":27.661375045776367},
|
|
collisionShape: "Sphere",
|
|
dynamic: true
|
|
});
|
|
}
|
|
}, this); |