mirror of https://github.com/qt/qtdoc.git
Dice: Extract calculation of 45degrees
Don't calculate this inside the for loop. Pick-to: 6.5 6.6 Change-Id: I09d46e363325071086332d901235f0feeabbb474 Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
This commit is contained in:
parent
94d585bc44
commit
0bc36e534e
|
@ -32,9 +32,10 @@ Node {
|
|||
|
||||
function spawnDice(numberOfDice, physicsMaterial) {
|
||||
reset();
|
||||
let degrees45 = Math.PI / 4;
|
||||
for (var index = 0; index < numberOfDice; index++) {
|
||||
let initialPosition
|
||||
= Qt.vector3d(0.11 * Math.cos(index / (Math.PI / 4)),
|
||||
= Qt.vector3d(0.11 * Math.cos(index / degrees45),
|
||||
index * 2.1, 0);
|
||||
createDie(initialPosition, physicsMaterial);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue