overte/examples/twoFallingEntities.js
Andrew Meadows 21b2d14956 converting existing JS scripts to use new damping
Old formula the scripts were using:  v *= damping

So a value of 0.999 was "little damping" and a value of 0.001 was "very strong damping",
but now that is reversed.

New formula: v *= (1 j- damping)^dt

A damping value of 0.001 now means "very little damping"
and a value of 0.999 means "very strong damping".
2015-01-05 11:25:15 -08:00

25 lines
800 B
JavaScript

//
// twoFallingEntities.js
//
// Creates a red 0.2 meter diameter ball right in front of your avatar that lives for 60 seconds
//
var radius = 0.1;
var position = Vec3.sum(MyAvatar.position, Quat.getFront(MyAvatar.orientation));
var properties = {
type: "Sphere",
position: position,
velocity: { x: 0, y: 0, z: 0},
gravity: { x: 0, y: -0.05, z: 0},
radius: radius,
damping: 0.00001,
color: { red: 200, green: 0, blue: 0 },
lifetime: 60
};
var newEntity = Entities.addEntity(properties);
position.x -= radius * 1.0;
properties.position = position;
var newEntityTwo = Entities.addEntity(properties);
Script.stop(); // no need to run anymore