Object positioning in sine pattern

Hi guys,

I am trying to spawn objects in sine wave pattern and this is the script I am using:

  // Use this for initialization
    	void Start () {
    		for(int i = 0; i<100; i++)
    		{
    			GameObject colNew = Instantiate(collectables[0], position, transform.rotation) as GameObject;
    			
    			Vector3 colPos = colNew.transform.position;
    			position.y = SinePosition(colPos.x);
    			
    			colNew.transform.position = position;
    			
    			position.x++;
    		}
    	}
    	
    	// Update is called once per frame
    	void Update () {
    	}
    	
    	public float SinePosition(float x)
    	{		
    		
    		float y = 0.5f + 0.5f * Mathf.Sin(2 * Mathf.PI * x);
    		Debug.Log ("X: " + x + "Y: " + y);
    		return y;
    	}

There is a difference in y value, but it so small that it looks like they were spawned in a straight line. Could anyone help me out as this problem drives me crazy now?

Thanks in advance.

try just using:

float y = Mathf.Sin(x);

and if need be include the vertical offset of +0.5 like in your example to adjust the minimum vertical placement and/or the the multiplier of 0.5 to adjust the shape of the sine wave itself.

float y = vertical_offset + multiplier * Mathf.Sin(x)

edit- forgot to mention the problem with your script: the sine of PI or multiples of PI in radians is zero.

Thanks it worked!