public override void OnActionReceived(ActionBuffers actionBuffers)
    {
        stepReward -= 0.0001f;
        for (int i = 0; i < 4; i++)
        {
            var actionX = actionBuffers.ContinuousActions[i * 3 + 0];
            var actionY = actionBuffers.ContinuousActions[i * 3 + 1];
            var actionZ = actionBuffers.ContinuousActions[i * 3 + 2];

            spider.SpiderLegs[i].LegsList[0].SetMotorVelocityAndForce(actionX * 1000, 200);
            spider.SpiderLegs[i].LegsList[1].SetMotorVelocityAndForce(actionY * 1000, 200);
            spider.SpiderLegs[i].LegsList[2].SetMotorVelocityAndForce(actionZ * 1000, 200);
        }

        // bool isLegOnFloor = false;
        // foreach (var leg in spider.SpiderLegs)
        // {
        //     foreach (var legElement in leg.LegsList)
        //     {
        //         isLegOnFloor = isLegOnFloor || legElement.OnFloor;
        //     }
        // }

        var curDistance = Vector3.Distance(spider.Position, finishTransform.position);
        var maxDistance = Vector3.Distance(spider.StartPosition, finishTransform.position);
        var progress    = 1 - (curDistance / maxDistance);

        if (progress <= -1 || spider.OnFloor || spider.CheckUpsideDown())
        {
            SetReward(-1f + stepReward);
            EndEpisode();
        }
        else if (curDistance < 3)
        {
            SetReward(1f + stepReward);
            EndEpisode();
        }
        else
        {
            var dir = finishTransform.position - spider.transform.position;
            SetReward(progress * Vector3.Dot(spider.transform.forward, dir.normalized) + stepReward);
        }
    }