Originally written in DBC, this DBP version is more efficient. This small tech demo
was inspired by Nvidia's
lightning demo
for the GeForce2 card. Use the mouse button to turn on the laser and blast the metallic
plate, leaving a scorched trail behind.
Chapter 17 of "Physics for Game Developers"
explains how to simulate cloth by using a collection of particles and springs. The
code in the book was written in C++ and simulates the movement of a flag in the wind
attached to a pole. All I've done here is port the code to DarkBasic. The download
includes the executable, flag texture image, source code, and dkshop.dll. The dkshop.dll
is a library created by Dmitry which allows DBP to access vertex data of 3D models, a vital
component in making cloth simulation pratical in applications. You can view details
of Dmitry's plugin here: Dmitry's DKShop
Controls:
- Use 'A' and 'Z' keys to adjust the strength of the wind
- Press the spacebar to disconnect the attached points and watch the flag float away