Can you please help me arrange this correctly…
#pragma strict
public var speed = 5f;
function Start () {
}
function Update () {
transform.position.x = (Mathf.PingPong (Time.time * speed, 5.1, 0.9));
}
Can you please help me arrange this correctly…
#pragma strict
public var speed = 5f;
function Start () {
}
function Update () {
transform.position.x = (Mathf.PingPong (Time.time * speed, 5.1, 0.9));
}
Try this as a starting point:
transform.position = new Vector3(.9 + Mathf.PingPong(Time.time * speed, 4.2), transform.position.y, transform.position.z);
Now the object goes between 0 and 5.1 Not 0.9 and 5.1