# scrolling camera

I found a curious problem while implementing an isometric like camera: scrolling up and down (considering up/down as upper/lower sides of screen) is slower than scrolling to left and right. Here is the code:

``````//camera scroll
if (dir==UP) {
transform.Translate(0,0,25*Time.deltaTime);
} else if (dir==DOWN) {
transform.Translate(0,0,-25*Time.deltaTime);
} else if (dir==LEFT) {
transform.Translate(-8,0,0*Time.deltaTime);
} else if (dir==RIGHT) {
transform.Translate(8,0,0*Time.deltaTime);
}
``````

As you can see, I have increased the multiplier a lot, but anyway it is much more slower. Also, i noticed that, unlike other engines, that required some math to determine up/down orientation if the camera node have been rotated, here I just simply multiply for the Z or X axis and thats all. Why is that?

transform.Translate( X, Y, Z ) moves an object by that amount regardless of its orientation - it does require math to move according to orientation, but Transform has functions that do the math for you.

When you use Time.deltaTime * N, you’re saying “N units per second”

So your translate statements above are moving by 25 units per second on the Z axis and by 8 units per update on the X axis (which is astronomically fast).

Yep, now I notice the big mistake Im making. Should be transform.Translate(8Time.deltaTime,0,0) instead of transform.Translate(8,0,0Time.deltaTime), copy&paste errors.