G'day guys,
I'm building a maze-collection game, and using a multidimensional array for movement (that's what [rowIndex] and [colIndex] deal with). My issue is a slight 'jerk' at each new 'grid'. I understand, from looking at a similar system that was put up on the scripts wiki ( http://www.unifycommunity.com/wiki/index.php?title=GridMove ), and I notice the line:
"tx = t - 1.0; // Used to prevent slight visual hiccups on "grid lines" due to Time.deltaTime variance"
I believe this refers to what I'm noticing. What's more, is it isn't noticeable on all machines, as I believe it's caused by frame rates, it'll only be visible on slower frame rates.
Here's a sample of how I'm moving things (this is only for West, each direction has a different IF statement).
else if (actualBearing == 'West' && (grid[rowIndex][colIndex-1]) == 1) {
west = true;
moving = true;
startPosition = transform.position;
endPosition = transform.position + Vector3.right * stepDistance * -1;
stepStartTime = Time.time;
pivot() ;
colIndex = colIndex-1;
junction = true;
realBearing = 'West';
}
}else {
var progress: float;
progress = (Time.time - stepStartTime) / stepTime;
if (progress >= 1.0) {
transform.position = endPosition;
moving = false;
} else {
transform.position = Vector3.Lerp(startPosition, endPosition, progress);
pivot() ;
}
progress = progress -1.0;
}
Does anybody have an idea what's causing this?
Cheers, I'll try fixing it myself. I didn't want to use Gridmove because this is my first 3D game project, and first game using JavaScript. I'd rather learn myself, you see, and there's no educational gain copy+pasting a prebuilt system, y'know?
– Ozale