merge the new developmentbranch into the test branch #39

Closed
j23f0712 wants to merge 431 commits from development2 into dev/test
Showing only changes of commit 4430b37581 - Show all commits

View File

@@ -39,14 +39,15 @@ public DiceControl(AssetManager assetManager){
@Override @Override
protected void controlUpdate(float tpf) { protected void controlUpdate(float tpf) {
float clampedTpf = Math.min(tpf, 0.05f); // Max 50 ms per frame
if (isRolling) { if (isRolling) {
if(!slerp) { if(!slerp) {
// Apply rotational velocity to the dice // Apply rotational velocity to the dice
spinWithAngularVelocity(tpf); spinWithAngularVelocity(clampedTpf);
// Gradually reduce rotational velocity (simulate deceleration) // Gradually reduce rotational velocity (simulate deceleration)
angularVelocity.subtractLocal( angularVelocity.subtractLocal(
angularVelocity.mult(deceleration * tpf) angularVelocity.mult(deceleration * clampedTpf)
); );
// Stop rolling when angular velocity is close to zero // Stop rolling when angular velocity is close to zero
@@ -55,7 +56,7 @@ protected void controlUpdate(float tpf) {
} }
} }
else { else {
timeElapsed += tpf * rollDuration; timeElapsed += clampedTpf * rollDuration;
if (timeElapsed > 1.0f) timeElapsed = 1.0f; if (timeElapsed > 1.0f) timeElapsed = 1.0f;
@@ -71,7 +72,7 @@ protected void controlUpdate(float tpf) {
} }
} }
}else if(spin){ }else if(spin){
spinWithAngularVelocity(tpf); spinWithAngularVelocity(clampedTpf);
} }
} }