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:
Kai Köhne 2023-06-22 13:37:28 +02:00
parent 94d585bc44
commit 0bc36e534e
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}