Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    149
  • comments
    510
  • views
    94995

Insight

Sign in to follow this  
noaktree

247 views

I hope you didn't think I was being lazy...

Because I haven't been. [smile] It doesn't look like I'll get to the witch game before Halloween so maybe we'll try for next year with that project. If you haven't been following then look at the previous entry. I created a dynamic 3rd person camera system. Pretty fun.

Anyway...

I'm now working on a complete set of camera classes and controllers which I'll eventually make public for cross platform development. The base class has built in zoom, earthquakes, and virtual frustum. There are track and path (linear, spline) classes which manipulate any camera derived from the base.

Earthquakes...

The earthquake class creates a modifier vector which can be applied to the literal camera position. It has 4 built in wave functions with a 5th option for a user defined wave function using a callback. The user sets the time of the shake, the time of the fadeout, the 3d vector of the shake (with optional randomization), the amplitude of the wave function, and the frequency of the wave. Creates a cool effect.

Some math type stuff...

I built new vector, quaternion, matrix, plane, interpolator, spline, and frustum classes which are now completely separated from dx. An interesting problem I ran into was interpolating a spline from the first to the last knot using a value t = 0 - 1 at a constant speed. Interpolation was available between each adjacent knot using a value from 0 - 1 but not across the whole spline.

To solve this I first needed to find the arc length between two knots. I found an approximation of the length by taking samples along the arc and summing the linear distances between each of the knots.

Using the arc length function between knots I calculated a percentage value for each of the knots where knot[0] = 0 and knot[knot_count-1] = 1. This value represents the percentage that an arc[kn, kn-1] is of the entire length of the spline. These values only need to be calculated whenever a knot position changes.

I already had a function i(n, t) which returns a vector on the spline between knot n and knot n+1. I needed to make I(t) which returns a vector on the spline between the first and last knots. I did this using the percentage values and i(n, t).

Vector I ( t )
{
kv [ ] = list of knot percentage values.
k = the knot index whose percentage value is closest to t and less than t.

return i ( k, ( t - kv[k] ) / ( kv[k+1] - kv[k] ) )
}

It seems to work well but I haven't properly teseted it yet.

Sooo much more...

I'll try to get back in the habit of posting every couple of days. The camera system is called Insight and looks to be worth my time.
Sign in to follow this  


2 Comments


Recommended Comments

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
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!