Beispiel #1
0
    /// <summary>
    /// Updates the Big Box when is behaving as a Cursor
    /// </summary>
    public void UpdateCursor()
    {
        //update submesh vert
        UpdateClosestSubMeshVert();
        if (UMath.nearEqualByDistance(ClosestVertOld, ClosestSubMeshVert, 0.01f))
        {
            return;
        }
        UpdateClosestVertexAndOld();

        //creates poly
        var locPoly = UPoly.CreateSubMeshPoly(ClosestSubMeshVert, prevWideSquares);

        locPoly = UPoly.ScalePoly(locPoly, -0.04f);//a bit smaller is not colliding with every edge

        UpdatePos(locPoly, 0.75f);

        bool isEven    = AreAllPointsEven(locPoly, 0.01f);
        bool isCollide = CheckIfColliding(locPoly);
        bool isOnFloor = IsOnTheFloor(locPoly);

        //if is even not coll and is on floor
        CheckAndSwitchColor(isEven && !isCollide && isOnFloor);
    }