mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
757badf4f6
commit
a55ba7b95b
232 changed files with 1282 additions and 936 deletions
|
@ -24,10 +24,10 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
switch (rotation)
|
||||
{
|
||||
case 0: return new Vector3(0f, 0f, headOffset.y);
|
||||
case 1: return new Vector3(headOffset.x, 0f, headOffset.y);
|
||||
case 2: return new Vector3(0f, 0f, headOffset.y);
|
||||
case 3: return new Vector3(-headOffset.x, 0f, headOffset.y);
|
||||
case 0: return new Vector3(0f, headOffset.y, 0);
|
||||
case 1: return new Vector3(headOffset.x, headOffset.y, 0);
|
||||
case 2: return new Vector3(0f, headOffset.y, 0f);
|
||||
case 3: return new Vector3(-headOffset.x, headOffset.y, 0f);
|
||||
default: return Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
@ -161,5 +161,23 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 GetBodyPartAnchor(ActorBody anchoringActorBody, string anchorName)
|
||||
{
|
||||
Actor anchoringActor = Workspace.GetActor(anchoringActorBody.actorID);
|
||||
Vector3 anchoringActorBodyPos = anchoringActorBody.transform.position;
|
||||
Quaternion anchoringActorBodyQuad = Quaternion.AngleAxis(anchoringActorBody.transform.rotation.eulerAngles.z, Vector3.forward);
|
||||
int anchoringActorFacing = anchoringActor.GetCurrentPosition().bodyFacing;
|
||||
|
||||
switch (anchorName)
|
||||
{
|
||||
case "torso": return anchoringActorBodyPos;
|
||||
case "head": return anchoringActorBody.GetComponentsInChildren<ActorBodyPart>().FirstOrDefault(x => x.bodyPart.ToLower() == "head").transform.position;
|
||||
case "groin": return anchoringActorBodyPos + anchoringActorBodyQuad * PawnUtility.GroinOffsetAt(anchoringActor.bodyType, anchoringActorFacing).FlipAxes();
|
||||
case "left breast": return anchoringActorBodyPos + anchoringActorBodyQuad * PawnUtility.BreastLeftOffsetAt(anchoringActor.bodyType, anchoringActorFacing).FlipAxes();
|
||||
case "right breast": return anchoringActorBodyPos + anchoringActorBodyQuad * PawnUtility.BreastRightOffsetAt(anchoringActor.bodyType, anchoringActorFacing).FlipAxes();
|
||||
default: return new Vector3();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue