Exemplo n.º 1
0
    private void OnSceneGUI()
    {
        FootStepper stepper   = target as FootStepper;
        var         pos       = stepper.transform.position;
        var         bottomDst = stepper.capsuleHeight / 2f;
        var         floorDst  = bottomDst + stepper.baseHeight * 1.5f;

        var bottomOfBodyPos = pos.AddY(-bottomDst);
        var floorPos        = pos.AddY(-floorDst);

        Handles.color = Color.white;
        Handles.DrawLine(bottomOfBodyPos, floorPos);

        Handles.color = Color.red;
        Handles.DrawWireDisc(floorPos, Vector3.up, stepper.maxLegLength);
    }
Exemplo n.º 2
0
    void Start()
    {
        footStepper = body.GetComponent <FootStepper>();

        GameObject leg = new GameObject("leg");

        leg.transform.SetParent(transform.parent);
        leg.transform.localPosition = Vector3.zero;

        lineRenderer                 = leg.AddComponent <LineRenderer>();
        lineRenderer.material        = new Material(Shader.Find("Sprites/Default"));
        lineRenderer.widthMultiplier = legWidth;
        lineRenderer.positionCount   = legSegments;
        lineRenderer.startColor      = lineRenderer.endColor = legColor;

        knee = new GameObject("knee");
        knee.transform.SetParent(body);
        knee.transform.position = Vector3.Lerp(hip.position, transform.position, 0.5f);
    }