Skip to content

Commit

Permalink
Merge pull request #3091 from CombatExtended-Continued/SpinRate
Browse files Browse the repository at this point in the history
spinRate support
  • Loading branch information
N7Huntsman authored Apr 22, 2024
2 parents f7091d1 + c5c040a commit b05a1d2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1206,9 +1206,18 @@ public override void DrawAt(Vector3 drawLoc, bool flip = false)
}
else
{
Quaternion shadowRotation = ExactRotation;
Quaternion projectileRotation = DrawRotation;
if (def.projectile.spinRate != 0f)
{
float num2 = GenTicks.TicksPerRealSecond / def.projectile.spinRate;
var spinRotation = Quaternion.AngleAxis(Find.TickManager.TicksGame % num2 / num2 * 360f, Vector3.up);
shadowRotation *= spinRotation;
projectileRotation *= spinRotation;
}
//Projectile
//Graphics.DrawMesh(MeshPool.plane10, DrawPos, DrawRotation, def.DrawMatSingle, 0);
Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), DrawPos, DrawRotation, def.DrawMatSingle, 0);
Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), DrawPos, projectileRotation, def.DrawMatSingle, 0);

//Shadow
if (castShadow)
Expand All @@ -1221,7 +1230,7 @@ public override void DrawAt(Vector3 drawLoc, bool flip = false)

//TODO : Vary ShadowMat plane
//Graphics.DrawMesh(MeshPool.plane08, shadowPos, ExactRotation, ShadowMaterial, 0);
Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), shadowPos, ExactRotation, ShadowMaterial, 0);
Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), shadowPos, shadowRotation, ShadowMaterial, 0);
}

Comps_PostDraw();
Expand Down

0 comments on commit b05a1d2

Please sign in to comment.