- Home /
How to translate object slow in one update call ?
Hello ppl, Here is my code:
void Update () {
if(!translated)
{
for(int x=1; x<Map.numColumns; x++) {
Tile_Pos = (float)Math.Round(Map.Tile[0,x][0] - transform.position.x,2);
Debug.Log(Time.deltaTime);
if( Tile_Pos < 1.55f || Tile_Pos == 1.55f ) {
transform.Translate( 1.55f, 0, 0);
translated = true;
}
}
}
I have made a grid and now I am trying to move my object grid wise for eg in loop1 it is on first grid, then on loop2 it is on second grid and so on..I am taking the distance between grid and object position and translating it answer times towards x axis, but the problem is object is moving very fast. As I am doing this in one for loop within one update method. How can I move it little slow. ??
The Update method gets called exactly once per frame- if you want things to happen over multiple frames (i.e, in more than about a 60th of a second), you need to model behaviour over several Updates! Which is to say, you can't have 'slow' movement within a single update loop.
Could you please explain more clearly what you are trying to do here? Do you want objects to slowly move towards target positions, or do you want objects to go to exact locations instantaneously? Without any context it is difficult to help with this kind of problem.
thnx ppl, I have changed my code and now it translates on every update call,
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Fade in Fade out in unity 1 Answer
Unity iPhone app size is too big 1 Answer
How can i display a pdf file in a unity scene ? 2 Answers
How to send UIImage data to Unity3d via a C# script and iOS plug-in? 1 Answer