RimWorld

RimWorld

Intimacy - A Lovin' Expansion
Animation suggestion
How about copying what Vanilla Races Expanded - Highmate does to animate its "Initiate lovin" ability? It is the same loving outside of bed but on ability instead of random interaction that intimacy does.

I will be honest, I have no idea how Rimworld specific C# modding works, but using dnSpy I found that in JobDriver_InitiateLovin class they do some sine math to move pawn bodies without any complicated animations, and it looks much better than just standing still pawns:
public override Vector3 ForcedBodyOffset { get { float num = Mathf.Sin((float)this.ticksLeft / 60f * 8f); if (this.pawn.gender == 2) { float num2 = Mathf.Max(Mathf.Pow((num + 1f) * 0.5f, 2f) * 0.2f - 0.06f, 0f); return new Vector3(0f, 0f, num2); } float num3 = Mathf.Sign(num); return new Vector3(JobDriver_InitiateLovin.<get_ForcedBodyOffset>g__EaseInOutQuad|14_0(Mathf.Abs(num) * 0.6f) * 0.09f * num3, 0f, 0f); } }
[CompilerGenerated] internal static float <get_ForcedBodyOffset>g__EaseInOutQuad|14_0(float v) { if ((double)v >= 0.5) { return 1f - Mathf.Pow(-2f * v + 2f, 4f) / 2f; } return 8f * v * v * v * v; }
< >
Showing 1-2 of 2 comments
turkler  [developer] 5 Oct @ 10:42pm 
Originally posted by Luneyl:
How about copying what Vanilla Races Expanded - Highmate does to animate its "Initiate lovin" ability? It is the same loving outside of bed but on ability instead of random interaction that intimacy does.

I will be honest, I have no idea how Rimworld specific C# modding works, but using dnSpy I found that in JobDriver_InitiateLovin class they do some sine math to move pawn bodies without any complicated animations, and it looks much better than just standing still pawns:
public override Vector3 ForcedBodyOffset { get { float num = Mathf.Sin((float)this.ticksLeft / 60f * 8f); if (this.pawn.gender == 2) { float num2 = Mathf.Max(Mathf.Pow((num + 1f) * 0.5f, 2f) * 0.2f - 0.06f, 0f); return new Vector3(0f, 0f, num2); } float num3 = Mathf.Sign(num); return new Vector3(JobDriver_InitiateLovin.<get_ForcedBodyOffset>g__EaseInOutQuad|14_0(Mathf.Abs(num) * 0.6f) * 0.09f * num3, 0f, 0f); } }
[CompilerGenerated] internal static float <get_ForcedBodyOffset>g__EaseInOutQuad|14_0(float v) { if ((double)v >= 0.5) { return 1f - Mathf.Pow(-2f * v + 2f, 4f) / 2f; } return 8f * v * v * v * v; }
I can't just ''copy what ve does'' that's called stealing code
Luneyl 6 Oct @ 2:17am 
Or an inspiration to use Mathf functions to animate pawns in a JobDriver :ersneak:
< >
Showing 1-2 of 2 comments
Per page: 1530 50