June 2013
Intermediate to advanced
346 pages
8h 42m
English
The first thing we’ll do is spread out our particles, and we’ll also vary the speed of each particle to give each particle fountain some more variety. Let’s go back to ParticleShooter and add the following member variables to the class:
| Particles/src/com/particles/android/objects/ParticleShooter.java | |
| | private final float angleVariance; |
| | private final float speedVariance; |
| | |
| | private final Random random = new Random(); |
| | |
| | private float[] rotationMatrix = new float[16]; |
| | private float[] directionVector = new float[4]; |
| | private float[] resultVector = new float[4]; |
Each shooter will have an angle variance that will control the spread of particles and a speed variance to ...
Read now
Unlock full access