Get a hovering effect ( up and down ) for a gameobject moving on a spline .

we have a gameobject moving on a spline but we want it to have a smooth up down motion as it moves along the spline path . I tried putting it as a child of another gameobject with an up down animation attached to it , but it is not smooth . any suggestion ?

To create a smoothly oscillating effect like what you described, try something like this, and changing the values to suit your situation:

public float currentpos = 0f;
public float accel = 0.1f;
public float speed = 0.1f;


public void ChangeSpeed(){

if (currentpos > 0){

    accel -= speed;

}else{

    accel += speed;

}

currentpos += speed;

}