Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Movement in cycles?

$
0
0
If I use this code in two obstacles, one with the delay and without it, the delayed one seems to teleport so it has the same value on the x-axis with the other one. Any idea why this happens? #pragma strict var speed = 5f; var delay = 1f; var pos1 = 1; var pos2 = 4.9; function Start () { Invoke ("Move", delay); } function Move (){ transform.position = new Vector3(pos1 + Mathf.PingPong(Time.time * speed, pos2), transform.position.y, transform.position.z); Invoke ("Move", 0); }

Viewing all articles
Browse latest Browse all 1875

Latest Images

Trending Articles



Latest Images