• entries
    59
  • comments
    74
  • views
    44084

Camera Work

Sign in to follow this  

416 views

I spent a few hours tonight cleaning up the camera movement code. There were badly named variables; old code, from other revisions, that no longer did anything; magic numbers; code to figure things for which D3DX already provides functions; and undocumented formulae. Fun times.

I started looking at this code in order to squash a bug: when moving to the maze side above or below the current one, there's a sudden shift because the view's up vector changes. When the camera followed the player precisely, it didn't matter, because the camera was aligned with the side's axial plane bisecting the view left and right* when the player was moving up or down to the neighboring side; but now that the camera accelerates, it's rarely aligned well enough for the shift to be unnoticeable.

The only real solution, of course, is to update the up vector every frame and have it be a true up vector, rather than update it when the player moves to the side above or below, and have it pointing in whichever axial direction is "up" based on the current camera orientation. But I got sidetracked looking at the horrendous code and didn't do it.

And I won't.

Not tonight, anyway. Partly because I'm still considering how best to approach it (even though I know myself well enough to know that I won't be able to think through it all until I'm halfway through implementing the change), and partly because I'm going to bed as soon as I post this.

I shall likely tackle the problem tomorrow. But for now: Good night.

*I hesitate to say Y-Z plane because the maze can be at any arbitrary rotation. Rather, it would be the axial plane most closely aligned with the camera's Y-Z plane
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now