|
3 | 3 | import arc.*;
|
4 | 4 | import arc.graphics.g2d.*;
|
5 | 5 | import arc.math.*;
|
| 6 | +import arc.util.*; |
6 | 7 | import mindustry.gen.*;
|
7 | 8 | import progressed.graphics.*;
|
8 | 9 |
|
@@ -52,11 +53,20 @@ public void draw(Bullet b){
|
52 | 53 | float scl = shadowScale(data.z),
|
53 | 54 | sX = Angles.trnsx(225f, data.z) + b.x,
|
54 | 55 | sY = Angles.trnsy(225f, data.z) + b.y,
|
55 |
| - sRot = Angles.angle(b.originX, b.originY, b.aimX, b.aimY), //TODO better shadow rotation calculation |
| 56 | + sRot = Angles.angle(b.originX, b.originY, b.aimX, b.aimY), |
56 | 57 | sAlpha = Draw3D.shadowAlpha(data.z);
|
| 58 | + |
| 59 | + float pitch = Tmp.v1.set(b.vel.len(), data.zVel).angle(); //0 - 90 or 270-360 |
| 60 | + if(pitch <= 90){ //Going vertical, aim away from current point. |
| 61 | + sRot = Mathf.lerp(sRot, sRot < 45f ? -135f : 225f, pitch / 90f); |
| 62 | + }else if(pitch >= 270f){ //Falling down, aim towards current point. |
| 63 | + sRot = Mathf.lerp(sRot, sRot > 225f ? 405f : 45f, (360f - pitch) / 90f); |
| 64 | + } |
| 65 | + float fsRot = sRot; //I love Java |
| 66 | + |
57 | 67 | Draw3D.shadow(() -> {
|
58 | 68 | Draw.scl(scl);
|
59 |
| - PMDrawf.shadow(region, sX, sY, sRot, sAlpha); |
| 69 | + PMDrawf.shadow(region, sX, sY, fsRot, sAlpha); |
60 | 70 | Draw.scl();
|
61 | 71 | });
|
62 | 72 | }
|
|
0 commit comments