Reader small image

You're reading from  Game Physics Cookbook

Product typeBook
Published inMar 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781787123663
Edition1st Edition
Languages
Tools
Concepts
Right arrow
Author (1)
Gabor Szauer
Gabor Szauer
author image
Gabor Szauer

Gabor Szauer has been making games since 2010. He graduated from Full Sail University in 2010 with a bachelor's degree in game development. Gabor maintains an active Twitter presence, and maintains a programming-oriented game development blog. Gabor's previously published books are Game Physics Programming Cookbook and Lua Quick Start Guide, both published by Packt.
Read more about Gabor Szauer

Right arrow

Cloth


We can use springs to model interesting soft body objects. Unlike a rigidbody, a soft body can change its shape. In this section, we will use springs to simulate cloth. Cloth is implemented as a point mass system. In a point mass system, every vertex of a mesh is represented by a particle. Every particle is attached to other particles by springs to force the object to maintain its shape.

If we arrange all the particles representing the vertices of a cloth in a grid, we can connect every row and column using springs. These springs are the structural springs of the cloth:

This, however, is not enough for an accurate simulation. If we set any one of the particles to have infinite mass so that it does not move, the cloth will collapse into a rope. We can improve the structural integrity of the cloth by adding shear springs. Shear springs connect every particle to its neighbors diagonally:

Having both structural and shear springs makes the cloth behave as expected in the scenario where one...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Game Physics Cookbook
Published in: Mar 2017Publisher: PacktISBN-13: 9781787123663

Author (1)

author image
Gabor Szauer

Gabor Szauer has been making games since 2010. He graduated from Full Sail University in 2010 with a bachelor's degree in game development. Gabor maintains an active Twitter presence, and maintains a programming-oriented game development blog. Gabor's previously published books are Game Physics Programming Cookbook and Lua Quick Start Guide, both published by Packt.
Read more about Gabor Szauer