• entries
149
510
• views
95300

# Insight

284 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.

Yay! Neil's back [grin]

Look forward to hearing more about the camera work!

Cheers,
Jack

Thanks Jack. [smile]

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!