I am using the 2 camera approach to getting a pixel perfect 2d background that scrolls. One camera shows the GUITextures and one shows the 3d objects in front of the GUITextures. My problem is that the background stutters as it moves in the background. My goal is to make a tiled system so that is why I need more than just animate uv. Here is my code for moving two GUITextures. Any idea as to why the textures are stuttering as they move? Thanks.
#pragma strict
var xVelocity : float = 0;
var background1 : GUITexture;
var background2 : GUITexture;
var backgroundDamper : float = 0.5;
function Update () {
// calculate the velocity over time and add it to each background image
var xVel : float = -xVelocity*Time.deltaTime;
background1.pixelInset.x += xVel;
background2.pixelInset.x += xVel;
// This readjusts the one that went off the left side onto the right side so it keeps on scrolling.
if(background1.pixelInset.x < -1200){
background1.pixelInset.x = background2.pixelInset.x + 800;
}
if(background2.pixelInset.x < -1200){
background2.pixelInset.x = background1.pixelInset.x + 800;
}
}
function adjustVelocity(xAdjustment : float){
xVelocity += xAdjustment * backgroundDamper;
}