Odd behavior with zooming
by Teck Lee Tan · in Torque Game Builder · 03/23/2005 (10:51 am) · 6 replies
I was testing out some camera zooms as alternatives to fadein/outs, and noticed some odd behavior when zooming in, that really is only evident with large changes in zoom (it started getting noticeable at about 25x zoom):
Basically, the zoom works. It accelerates, then decelerates. No problems there. When you first call startCameraMove, however, the zoom "jumps" in a bit (more and more noticeable with larger zoomtargets). Zooming back out likewise causes a jump, but this time at the end of the zoom move.
I'm not sure if I'm setting things up properly, or if it's a bug in the camerazoom code (I'll try and take a look if I have time today), or if it's simply not setup to handle large moves like this.
Here's the relevant code, for reference:
edit: oh, and in case it wasn't clear, the interpolation mode is set to Sigmoid. The initial jump doesn't happen with linear interpolation. So I'll be looking at the appropriate part of the code in the meantime.
Basically, the zoom works. It accelerates, then decelerates. No problems there. When you first call startCameraMove, however, the zoom "jumps" in a bit (more and more noticeable with larger zoomtargets). Zooming back out likewise causes a jump, but this time at the end of the zoom move.
I'm not sure if I'm setting things up properly, or if it's a bug in the camerazoom code (I'll try and take a look if I have time today), or if it's simply not setup to handle large moves like this.
Here's the relevant code, for reference:
playerMap.bindCmd(keyboard, "[", "playerzoomOut();", "");
playerMap.bindCmd(keyboard, "]", "playerzoomIn();", "");
function playerzoomIn()
{
%z = 1000 * sceneWindow2D.getCurrentCameraZoom();
sceneWindow2D.setTargetCameraZoom(%z);
sceneWindow2D.startCameraMove(5);
}
function playerzoomOut()
{
%z = 0.001 * sceneWindow2D.getCurrentCameraZoom();
sceneWindow2D.setTargetCameraZoom(%z);
sceneWindow2D.startCameraMove(5);
}edit: oh, and in case it wasn't clear, the interpolation mode is set to Sigmoid. The initial jump doesn't happen with linear interpolation. So I'll be looking at the appropriate part of the code in the meantime.
#2
03/23/2005 (12:07 pm)
Thanks Melv. Good to know I wasn't hallucinating. :-p I took a look at the interpolation function, and my head is hurting from looking at the formula, so I'm not going to be of any help there. I knew I should've paid more attention in math classes. o_O
#4
The formula looks correct, as do the calculations (being mindful, of course, that I've sort of lost touch with my higher math). My guess is it's something about the way the function is being called, rather than the formulae, since the jump only happens at the beginning of a zoom-in, and the end of a zoom-out.
03/24/2005 (6:34 am)
Heck if I can figure it out. :-pThe formula looks correct, as do the calculations (being mindful, of course, that I've sort of lost touch with my higher math). My guess is it's something about the way the function is being called, rather than the formulae, since the jump only happens at the beginning of a zoom-in, and the end of a zoom-out.
#5
I have fixed this problem. It will be included in the next update.
It was a calculation error in the 'sigmoid' function.
Thanks for the report.
- Melv.
03/30/2005 (11:10 am)
FYII have fixed this problem. It will be included in the next update.
It was a calculation error in the 'sigmoid' function.
Thanks for the report.
- Melv.
#6
03/30/2005 (2:04 pm)
Hoo-ah! :)
Associate Melv May
I'll add that one to the list. I think I may have seen that before but I wasn't sure if it was just a timing glitch or a big in the interpolation scheme somehow.
Thanks for the heads-up. :)
- Melv.