@Override public void apply(float dt, Particle particle, int index) { if (particle.getStatus() == Particle.Status.Alive && floor.pseudoDistance(particle.getPosition()) <= 0) { float t = (floor.getNormal().dot(particle.getPosition()) - floor.getConstant()) / floor.getNormal().dot(particle.getVelocity()); Vector3f s = particle.getPosition().subtract(particle.getVelocity().mult(t)); this.normal.normalizeLocal(); Vector3f v1 = this.normal.cross(s.subtract(pos)); Vector3f v2 = this.normal.cross(v1); v1.normalizeLocal(); v2.normalizeLocal(); Vector3f newVel = new Vector3f(particle.getVelocity()); newVel.y *= -bouncyness; Quaternion q = new Quaternion(); q.fromAxes(v1, this.normal, v2); newVel = q.mult(newVel); particle.setVelocity(newVel); } // if }