|
Written by Ryan Juckett
|
|
Friday, 20 July 2012 02:54 |
|

I’ve worked on third-person camera systems for numerous games and I often need a method for smoothing camera motion as the player moves through the world. The player’s motion may create sharp, discontinuous changes in direction, speed or even position. The camera, however, should:
- Avoid discontinuities in motion. Accelerate and decelerate as needed rather than snap to a new velocity.
- Never let the player outrun the camera. The farther away he gets, the faster the camera needs to move.
- Move exactly the same with respect to time regardless of frame rate.
To solve this problem, I often simulate the camera with a set of damped springs.
|
|
Last Updated ( Thursday, 02 May 2013 06:36 )
|
|
Read more...
|
|
|
Written by Ryan Juckett
|
|
Saturday, 28 August 2010 06:03 |
|
There are multiple undocumented functions in ActionScript 2.0 of which one is ASSetPropFlags. I needed to use this function on a project recently and quickly found out that most of the unofficial documentation is either incorrect or overly brief. What I'm going to do here is describe how the function works and then show a program that will test and confirm some of the more complex functionality.
|
|
Last Updated ( Saturday, 28 August 2010 23:50 )
|
|
Read more...
|
|
Written by Ryan Juckett
|
|
Sunday, 02 May 2010 06:32 |
Having just written a parser for TGA image files, I had the pleasure of learning that the storage method for color data was not clearly defined by the documentation and that the few pieces of example code I could find all contained bugs. In an attempt to rectify the issue, let's walk through the different ways color data can be packed into a TGA file and how to read it back.
|
|
Last Updated ( Sunday, 02 May 2010 09:28 )
|
|
Read more...
|
|
|
Written by Ryan Juckett
|
|
Sunday, 16 May 2010 00:00 |
|
I've been on a bit of a color science kick lately and transferring from one color space to another becomes a common operation when you want to properly play with digital color values. Normally we just think of digital colors as RGB values, but there are many ways to numerically describe a color. Just opening PhotoShop's color picker lets you choose colors as HSV, Lab, or CMYK values in addition to the standard RGB. If you're a bit more adept with PhotoShop, you've may have even ventured into the Color Settings which has even more options including which version of RGB that your image will use. It is this concept of multiple RGB spaces that I'm going to focus on.
|
|
Last Updated ( Tuesday, 31 August 2010 16:16 )
|
|
Read more...
|
|
Written by Ryan Juckett
|
|
Wednesday, 14 April 2010 06:21 |
|
I recently wrote a text parser for Wavefront OBJ files and once I got it all up and running, I was surprised by the performance. I tend to be somewhat performance conscious when writing code so after realizing I had somehow created the slowest OBJ parser known to man, I was perplexed. It was taking 20 seconds to load the Stanford Bunny (4.83MB as an OBJ file with exported normals).
When parsing a 3d mesh from an OBJ file, it is optimal to collapse equal vertices into an indexed list. This is one of the more complicated steps so my suspicion was that something went wrong there. I was using a hash table to do the comparisons so it should have been fast. I disabled that section of code, and timed the load again. It barely affected the result.
Another common pitfall when parsing files is getting stalls from seeking through the file itself. I had already taken that into consideration and just loaded the whole thing into memory for processing. I was out of ideas and decided to profile the load and see what I had done wrong. I learned that almost all of my time was spent in strlen which was a big red flag considering I never even called strlen during my entire load.
|
|
Last Updated ( Saturday, 28 August 2010 23:28 )
|
|
Read more...
|
|
|
|
|
<< Start < Prev 1 2 Next > End >>
|
|
Page 1 of 2 |