mirror of
https://github.com/SunNetservers/Launchpad.git
synced 2025-03-31 08:46:29 +02:00
Fixes pyramid particles having the wrong angle sometimes
This commit is contained in:
parent
7dd4718d72
commit
b558129944
@ -84,14 +84,14 @@ public class ParticleSpawner implements Runnable {
|
|||||||
drawSquare(world, location);
|
drawSquare(world, location);
|
||||||
// Top: 0.5, 1, 0.5. Corner 1: 0, 0, 0. Corner 2: 1, 0, 0. Corner 3: 0, 0, 1, Corner 4: 1, 0, 1
|
// Top: 0.5, 1, 0.5. Corner 1: 0, 0, 0. Corner 2: 1, 0, 0. Corner 3: 0, 0, 1, Corner 4: 1, 0, 1
|
||||||
double triangleHeight = 1;
|
double triangleHeight = 1;
|
||||||
//TODO: This works fine for heightOffset = 1, but changing the height offset changes things. 0 offset causes
|
|
||||||
// the pyramid to become too wide. 2 offset causes the pyramid to become too narrow.
|
|
||||||
Vector topVector = new Vector(0.5, triangleHeight + heightOffset, 0.5);
|
Vector topVector = new Vector(0.5, triangleHeight + heightOffset, 0.5);
|
||||||
Location topLocation = location.clone().add(topVector);
|
Location topLocation = location.clone().add(topVector);
|
||||||
Vector line1Direction = new Vector(-0.5, 0, -0.5).subtract(topVector).normalize();
|
double coordinateMin = -0.5 * heightOffset;
|
||||||
Vector line2Direction = new Vector(1.5, 0, -0.5).subtract(topVector).normalize();
|
double coordinateMax = 1 + (0.5 * heightOffset);
|
||||||
Vector line3Direction = new Vector(-0.5, 0, 1.5).subtract(topVector).normalize();
|
Vector line1Direction = new Vector(coordinateMin, 0, coordinateMin).subtract(topVector).normalize();
|
||||||
Vector line4Direction = new Vector(1.5, 0, 1.5).subtract(topVector).normalize();
|
Vector line2Direction = new Vector(coordinateMax, 0, coordinateMin).subtract(topVector).normalize();
|
||||||
|
Vector line3Direction = new Vector(coordinateMin, 0, coordinateMax).subtract(topVector).normalize();
|
||||||
|
Vector line4Direction = new Vector(coordinateMax, 0, coordinateMax).subtract(topVector).normalize();
|
||||||
|
|
||||||
for (double x = 0; x <= triangleHeight; x += particleDensity) {
|
for (double x = 0; x <= triangleHeight; x += particleDensity) {
|
||||||
spawnParticle(world, topLocation.clone().add(line1Direction.clone().multiply(x)));
|
spawnParticle(world, topLocation.clone().add(line1Direction.clone().multiply(x)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user