mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:01:09 +02:00
Fix error with angular speed
This commit is contained in:
parent
d17c3c078a
commit
63c1bdd0a8
1 changed files with 4 additions and 3 deletions
|
@ -45,6 +45,9 @@ var diceButton = Overlays.addOverlay("image", {
|
||||||
|
|
||||||
var GRAVITY = -3.5;
|
var GRAVITY = -3.5;
|
||||||
var LIFETIME = 300;
|
var LIFETIME = 300;
|
||||||
|
// NOTE: angularVelocity is in radians/sec
|
||||||
|
var MAX_ANGULAR_SPEED = Math.PI;
|
||||||
|
|
||||||
function shootDice(position, velocity) {
|
function shootDice(position, velocity) {
|
||||||
for (var i = 0; i < NUMBER_OF_DICE; i++) {
|
for (var i = 0; i < NUMBER_OF_DICE; i++) {
|
||||||
dice.push(Entities.addEntity(
|
dice.push(Entities.addEntity(
|
||||||
|
@ -53,9 +56,7 @@ function shootDice(position, velocity) {
|
||||||
position: position,
|
position: position,
|
||||||
velocity: velocity,
|
velocity: velocity,
|
||||||
rotation: Quat.fromPitchYawRollDegrees(Math.random() * 360, Math.random() * 360, Math.random() * 360),
|
rotation: Quat.fromPitchYawRollDegrees(Math.random() * 360, Math.random() * 360, Math.random() * 360),
|
||||||
// NOTE: angularVelocity is in radians/sec
|
angularVelocity: { x: Math.random() * MAX_ANGULAR_SPEED, y: Math.random() * MAX_ANGULAR_SPEED, z: Math.random() * MAX_ANGULAR_SPEED },
|
||||||
var maxAngularSpeed = Math.PI;
|
|
||||||
angularVelocity: { x: Math.random() * maxAngularSpeed, y: Math.random() * maxAngularSpeed, z: Math.random() * maxAngularSpeed },
|
|
||||||
lifetime: LIFETIME,
|
lifetime: LIFETIME,
|
||||||
gravity: { x: 0, y: GRAVITY, z: 0 },
|
gravity: { x: 0, y: GRAVITY, z: 0 },
|
||||||
shapeType: "box",
|
shapeType: "box",
|
||||||
|
|
Loading…
Reference in a new issue