Pass a object position to shader and calculate the distance

Hi
I just read an article about how to make grass, now I want to step forward, let other objects affect the grass.
Here is the original article Unity Grass Shader Tutorial

And here is my C# code to pass positions to the shader.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveInterActive : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject grassModel;
    public Material grassMat;
    public Transform[] obstacles;

    private Vector4[] obstaclePositions = new Vector4[100];
    private MeshFilter meshFilter;
    private MeshRenderer meshRenderer;
    void Start()
    {
        meshFilter = gameObject.AddComponent<MeshFilter> () as MeshFilter;
        meshRenderer = gameObject.AddComponent<MeshRenderer> () as MeshRenderer;
        meshRenderer.material = grassMat;

    }

    // Update is called once per frame
    void Update()
    {
    for (int n = 0; n < obstacles.Length; n++) {
            obstaclePositions [n] = obstacles [n].position;
            Debug.Log(obstacles [n].position);
        }

    Shader.SetGlobalFloat("_PositionArray", obstacles.Length);
    Shader.SetGlobalVectorArray("_ObstaclePositions", obstaclePositions);
    //Debug.Log(obstaclePositions [0]);

    }
    
 
}

And the debug tells me, I go the positions correctly at c# Part.

But when I try to get the distance through this:

float4 wodpos = mul(unity_ObjectToWorld, pos);
for (int n = 0; n < _PositionArray; n++){
             float dis =  distance(wodpos,_ObstaclePositions[n]);
(dis<0)?(height=0):(height=1);
            };
....
triStream.Append(GenerateGrassVertex(pos, segmentWidth, segmentHeight,segmentForward, float2(0, t), transformationMatrixFacing));
triStream.Append(GenerateGrassVertex(pos, -segmentWidth, segmentHeight, segmentForward,float2(1, t), transformationMatrixFacing));
triStream.Append(GenerateGrassVertex(pos, 0, height,forward, float2(0.5, 1), transformationMatrix));

I assume that I need to convert the vertex pos to world cord, but I am not sure. Did I miss anything?

UPDATE
i pass the dis to color, and I found it works. So the problem probably is

dis = dis - _EffectRadius;
dis>0?(height= (rand(pos.zyx) * 2 - 1) * _BladeHeightRandom + _BladeHeight):(height=0);

always goes to the false condition value? Did anybody know why?

5934434--634877--Screenshot at 2020-06-03 18-47-02.png

Is this because I work with geometry shader?

I got this, problem solved