Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Using splines to create a smooth curve between many points [DBPro]

Author
Message
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 18th Apr 2004 16:53 Edited at: 18th Apr 2004 16:56
This should come in handy for some people who need to make racing tracks, rollercoasters or smooth camera movement between points. This code uses the DBPro 3D Maths commands to find the points along a catmull rom spline. The good thing about this spline is that it passes through ALL of the points, and you can link many of them up to create a long smooth curving line, due to the fact that the tangent at the end points are the same.

For technical info on catmull rom splines look here...
http://www.mvps.org/directx/articles/catmull

You can also use vector3 for 3D splines, they work in exactly the same way but it requires and outputs 3 coordinates.

Trying is the first step towards faliure.
Athelon XP 1600+/Radeon 9600 Pro/256 RAM
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Apr 2004 19:59
catmull splines is basically a line that goes through a set of specified points?

"eureka" - Archimedes
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 19th Apr 2004 20:44
Yep, a curved line. It's handy for finding a SMOOTH path from point to point.

Trying is the first step towards faliure.
Athelon XP 1600+/Radeon 9600 Pro/256 RAM
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 20th Apr 2004 17:58
cool!...though i'm not sure if i'd ever be able to figure it out to actually use...


Formerly known as "DarkWing Duck"
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 21st Apr 2004 23:25
Quote: "Yep, a curved line. It's handy for finding a SMOOTH path from point to point."

are the calculations faster than just adding more points? i.e. you have a race game where the computer has a path of points set, which are then followed by the computer player.



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 24th Apr 2004 00:26
The calculations are very fast, and it will certainly wave you time plotting all the points to make a curve. And even then it won't be a real curve.

Trying is the first step towards faliure.
Athelon XP 1600+/Radeon 9600 Pro/256 RAM

Login to post a reply

Server time is: 2024-05-12 21:31:01
Your offset time is: 2024-05-12 21:31:01