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