Per-player needs, jumping figure, round belt/shoulders/boots, reset-point UI
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+28
-15
@@ -21,6 +21,7 @@ namespace MSCO
|
||||
const float TorsoLength = 0.55f; // Hüfte bis Hals
|
||||
const float HipWidth = 0.1f, ShoulderWidth = 0.21f;
|
||||
const float AnkleHeight = 0.07f;
|
||||
const float LegReach = ThighLength + ShinLength + AnkleHeight - 0.02f; // Hüfthöhe bei gestrecktem Bein
|
||||
|
||||
static readonly Color Skin = new Color(0.86f, 0.66f, 0.52f);
|
||||
static readonly Color Jeans = new Color(0.2f, 0.26f, 0.38f);
|
||||
@@ -39,7 +40,7 @@ namespace MSCO
|
||||
Transform pelvis, torso, belt, neck, belly, collar, placket, buckle;
|
||||
readonly Transform[] thigh = new Transform[2], shin = new Transform[2], boot = new Transform[2];
|
||||
readonly Transform[] upperArm = new Transform[2], forearm = new Transform[2], hand = new Transform[2];
|
||||
readonly Transform[] sole = new Transform[2], cuff = new Transform[2];
|
||||
readonly Transform[] sole = new Transform[2], cuff = new Transform[2], shoulderBall = new Transform[2];
|
||||
|
||||
Vector3 targetFeet;
|
||||
Vector3 targetHead;
|
||||
@@ -50,6 +51,7 @@ namespace MSCO
|
||||
|
||||
Vector3 lastPosition;
|
||||
float walkPhase, walkAmount, speed;
|
||||
float airAmount; // 0 = steht am Boden, 1 = in der Luft (Sprung, Fallen)
|
||||
|
||||
public int HeldId { get { return last.HeldId; } }
|
||||
public PlayerState LastState { get { return last; } }
|
||||
@@ -90,7 +92,7 @@ namespace MSCO
|
||||
pelvis = Capsule("Pelvis", r, Jeans);
|
||||
torso = Textured(Capsule("Chest", r, Color.white), plaid, new Vector2(4f, 4f));
|
||||
belly = Textured(Capsule("Belly", r, Color.white), plaid, new Vector2(4f, 2f));
|
||||
belt = Box("Belt", r, new Color(0.2f, 0.13f, 0.08f));
|
||||
belt = Primitive(PrimitiveType.Cylinder, "Belt", r, new Color(0.2f, 0.13f, 0.08f)); // rund um den Bauch
|
||||
buckle = Box("Buckle", r, Metal);
|
||||
placket = Box("Buttons", r, jacketDark);
|
||||
collar = Capsule("Collar", r, jacketDark);
|
||||
@@ -100,11 +102,12 @@ namespace MSCO
|
||||
{
|
||||
thigh[i] = Capsule("Thigh", r, Jeans);
|
||||
shin[i] = Capsule("Shin", r, Jeans * 0.92f);
|
||||
boot[i] = Box("Boot", r, Boots);
|
||||
sole[i] = Box("Sole", r, Sole);
|
||||
boot[i] = Capsule("Boot", r, Boots); // abgerundete Arbeitsstiefel statt Klötze
|
||||
sole[i] = Capsule("Sole", r, Sole);
|
||||
upperArm[i] = Textured(Capsule("UpperArm", r, Color.white), plaid, new Vector2(2f, 3f));
|
||||
forearm[i] = Textured(Capsule("Forearm", r, Color.white), plaid, new Vector2(2f, 3f));
|
||||
cuff[i] = Capsule("Cuff", r, jacketDark);
|
||||
shoulderBall[i] = Textured(Sphere("Shoulder", r, Color.white, 0.13f), plaid, new Vector2(2f, 2f)); // runde Schulter
|
||||
hand[i] = Sphere("Hand", r, Skin, 0.1f);
|
||||
}
|
||||
|
||||
@@ -292,6 +295,7 @@ namespace MSCO
|
||||
|
||||
// Hüfte: beim Lehnen nach hinten ausweichen, beim Ducken absinken (Füße bleiben am Boden)
|
||||
Vector3 hip;
|
||||
float air = 0f;
|
||||
if (last.Seated)
|
||||
{
|
||||
hip = neckBase + new Vector3(0f, -TorsoLength, -0.08f);
|
||||
@@ -302,8 +306,12 @@ namespace MSCO
|
||||
hip = -lean * 0.25f;
|
||||
float horizontal = (new Vector3(neckBase.x - hip.x, 0f, neckBase.z - hip.z)).magnitude;
|
||||
float vertical = Mathf.Sqrt(Mathf.Max(0.04f, TorsoLength * TorsoLength - horizontal * horizontal));
|
||||
hip.y = Mathf.Clamp(neckBase.y - vertical, 0.3f, ThighLength + ShinLength + AnkleHeight - 0.02f);
|
||||
// Ist der Kopf höher, als die Beine reichen (Sprung, Fallen), hebt die ganze Figur ab - vorher blieben die
|
||||
// Füße am Boden und nur der Oberkörper ging nach oben
|
||||
hip.y = Mathf.Max(0.3f, neckBase.y - vertical);
|
||||
air = Mathf.Max(0f, hip.y - LegReach);
|
||||
}
|
||||
airAmount = Mathf.Lerp(airAmount, last.Seated ? 0f : Mathf.Clamp01(air / 0.12f), dt > 0f ? Mathf.Clamp01(dt * 10f) : 1f);
|
||||
|
||||
Vector3 up = (neckBase - hip).normalized;
|
||||
Vector3 right = Vector3.right;
|
||||
@@ -316,8 +324,8 @@ namespace MSCO
|
||||
Segment(belly, hip + up * 0.07f + forward * 0.015f, hip + up * 0.3f + forward * 0.015f, 0.33f, 0.25f);
|
||||
belt.localPosition = hip + up * 0.06f;
|
||||
belt.localRotation = torsoRot;
|
||||
belt.localScale = new Vector3(0.345f, 0.045f, 0.275f);
|
||||
buckle.localPosition = hip + up * 0.06f + forward * 0.14f;
|
||||
belt.localScale = new Vector3(0.34f, 0.024f, 0.27f); // Zylinder: 0.048 m hoch, elliptisch
|
||||
buckle.localPosition = hip + up * 0.06f + forward * 0.136f;
|
||||
buckle.localRotation = torsoRot;
|
||||
buckle.localScale = new Vector3(0.055f, 0.04f, 0.012f);
|
||||
placket.localPosition = Vector3.Lerp(hip + up * 0.12f, neckBase, 0.6f) + forward * 0.124f;
|
||||
@@ -331,7 +339,7 @@ namespace MSCO
|
||||
headPivot.localPosition = head;
|
||||
headPivot.localRotation = Quaternion.Euler(pitch, 0f, 0f);
|
||||
|
||||
float swing = Mathf.Sin(walkPhase) * walkAmount;
|
||||
float swing = Mathf.Sin(walkPhase) * walkAmount * (1f - airAmount);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float side = i == 0 ? -1f : 1f;
|
||||
@@ -343,19 +351,24 @@ namespace MSCO
|
||||
if (last.Seated)
|
||||
ankle = hipJoint + new Vector3(0f, -0.4f, 0.48f);
|
||||
else
|
||||
{
|
||||
ankle = new Vector3(HipWidth * side, AnkleHeight + Mathf.Max(0f, Mathf.Cos(walkPhase + i * Mathf.PI)) * 0.07f * walkAmount, phase * 0.3f);
|
||||
// In der Luft: Füße unter der Hüfte mitnehmen und die Knie etwas anziehen
|
||||
ankle.y += air + 0.1f * airAmount;
|
||||
ankle.z -= 0.06f * airAmount;
|
||||
}
|
||||
Vector3 knee = Joint(hipJoint, ankle, ThighLength, ShinLength, Vector3.forward);
|
||||
Segment(thigh[i], hipJoint, knee, 0.15f, 0.16f);
|
||||
Segment(shin[i], knee, ankle, 0.12f, 0.13f);
|
||||
boot[i].localPosition = ankle + new Vector3(0f, -0.015f, 0.05f);
|
||||
boot[i].localRotation = Quaternion.identity;
|
||||
boot[i].localScale = new Vector3(0.12f, 0.1f, 0.27f);
|
||||
sole[i].localPosition = ankle + new Vector3(0f, -0.065f, 0.05f);
|
||||
sole[i].localRotation = Quaternion.identity;
|
||||
sole[i].localScale = new Vector3(0.13f, 0.025f, 0.29f);
|
||||
// Stiefel: Kapsel von der Ferse zur Spitze, darunter eine flache Sohle
|
||||
Segment(boot[i], ankle + new Vector3(0f, -0.025f, -0.06f), ankle + new Vector3(0f, -0.03f, 0.14f), 0.12f, 0.1f);
|
||||
Segment(sole[i], ankle + new Vector3(0f, -0.07f, -0.075f), ankle + new Vector3(0f, -0.07f, 0.155f), 0.125f, 0.03f);
|
||||
|
||||
// Arme
|
||||
Vector3 shoulder = neckBase - up * 0.06f + right * (ShoulderWidth * side);
|
||||
shoulderBall[i].localPosition = shoulder + up * 0.005f;
|
||||
shoulderBall[i].localRotation = torsoRot;
|
||||
shoulderBall[i].localScale = new Vector3(0.125f, 0.12f, 0.13f);
|
||||
Vector3 handTarget;
|
||||
Vector3 heldPos;
|
||||
Quaternion heldRot;
|
||||
@@ -364,7 +377,7 @@ namespace MSCO
|
||||
else if (last.Seated)
|
||||
handTarget = shoulder + new Vector3(-side * 0.05f, -0.3f, 0.38f); // Hände nach vorne (Lenkrad)
|
||||
else
|
||||
handTarget = shoulder + new Vector3(side * 0.06f, -(UpperArmLength + ForearmLength) + 0.05f, 0.02f - phase * 0.22f);
|
||||
handTarget = shoulder + new Vector3(side * (0.06f + 0.12f * airAmount), -(UpperArmLength + ForearmLength) + 0.05f + 0.14f * airAmount, 0.02f - phase * 0.22f);
|
||||
|
||||
// Nicht weiter als die Armlänge
|
||||
Vector3 reach = handTarget - shoulder;
|
||||
|
||||
Reference in New Issue
Block a user