Hi every Body i want to make tthe same style of game zoi and i’m asking in making a cube translate and back i do that with script and i have the cube translate in one direction and do that again with animation but i have a probleme that the cube does not translate normaly it look like an obstacle make him to zigzag. any response please
thank you
You’ll need to show us your code so we can help you
1 Like
Use Unity - Scripting API: Mathf.PingPong and then just do Vector3.Lerp
1 Like
there is the code
function Update(){
if(transform.position.x <4){
transform.Translate(Vector3.left *0.1f);}elseif(transform.position.x >-4)
{
transform.Translate(Vector3.right *0.1f);
}
}
but i have the cube translate in one direction
works for me thank you soo much
1 Like