边缘世界 RimWorld

边缘世界 RimWorld

Intimacy - A Lovin' Expansion
Luneyl 10 月 4 日 下午 5:08
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; }
< >
正在显示第 1 - 2 条,共 2 条留言
turkler  [开发者] 10 月 5 日 下午 10:42 
引用自 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 10 月 6 日 上午 2:17 
Or an inspiration to use Mathf functions to animate pawns in a JobDriver :ersneak:
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50