Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1479e7d authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Fix physics bug causing balls to stack."

parents b4f666f1 c8abdeda
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import android.renderscript.*;
import android.util.Log;

public class BallsRS {
    public static final int PART_COUNT = 800;
    public static final int PART_COUNT = 1000;

    public BallsRS() {
    }
+14 −1
Original line number Diff line number Diff line
@@ -41,8 +41,21 @@ void root(const Ball_t *ballIn, Ball_t *ballOut, const BallControl_t *ctl, uint3
                fv -= (vec / (len * len * len)) * 20000.f;
            } else {
                if (len2 < 0.1) {
                    if (xin == x) {
                        continue;
                    }
                    ballOut->delta = 0.f;
                    ballOut->position = ballIn->position;
                    if (xin > x) {
                        ballOut->position.x += 1.f;
                    } else {
                        ballOut->position.x -= 1.f;
                    }
                    ballOut->color.rgb = 1.f;
                    ballOut->arcID = -1;
                    ballOut->arcStr = 0;
                    return;
                }
                // Collision
                float2 axis = normalize(vec);
                float e1 = dot(axis, ballIn->delta);