- Home /
Moving object top to down
Cubes coming downing(vertically) and they will collide line,so what should i do for this means use of parallel-ex scrolling apply on these cubes or transform.translate or transfrom.movetowards give me your suggestion which is best way to achieve this.one thing more when cube collide with line everything should stop moving.
Answer by ShadyProductions · Jun 18, 2017 at 08:04 AM
If you are just moving the cubes downwards in a straight line, you can just use transform.translate
//put this inside the Update
gameObject.transform.Translate(0,-(time.deltaTime * 0.5f), 0);
//if the gameobject reaches the bottom (you'll have to change this to your fitting)
if (gameobject.transform.position.y <= 0)
//pool it orsomething
thanks for answer but actually my question is that cubes are continually co$$anonymous$$g down in like picture.when cube collide with line every cube in the scene should stop moving and after certain amount of time moving start again.how to give this a really look.i am very thank full to you
Answer by RhisisLS · Jun 18, 2017 at 08:46 AM
You can use Time.timeScale and set the value to 0f. It basically freezes time and you can also give it cooler effects like slowing down when you hit the line.
Time.timeScale = 0f;
Time.timeScale=0f; when i do this its slow down over all game but i wanna do only stop moving objects and detect the collision.
Your answer
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
How to measure Speed? 2 Answers
How do I fix collisions while using this PlayerController script? 1 Answer
Distribute terrain in zones 3 Answers
How do I make my Player move? 1 Answer