elemel / crust

CRUST
1 stars 1 forks source link

Block physics #4

Closed elemel closed 12 years ago

elemel commented 12 years ago

Adapt physics shapes to arbitrary blocks. User can interact with blocks directly using the mouse.

elemel commented 12 years ago
  1. Use flood fill to find outer border of block elements, as well as their non-element neighbors. 2. Fit shapes so that they overlap all border cells but none of the neighbor cells.
elemel commented 12 years ago

When adapting polygons, place each vertex in the center of a grid cell. When adapting circles, place the center of the circle in the center of a grid cell. Make the circle radius a multiple of the grid cell size. Prefer circles over polygons.

elemel commented 12 years ago

Might use edge chains for static bodies.

elemel commented 12 years ago

Compute mass data from the grid cells, not from the adapted shapes.

elemel commented 12 years ago

When adapting shapes, first try a circle. If that fails, use an edge chain. If the body is dynamic, convert the edge chain to polygons.

elemel commented 12 years ago

Read more about Voronoi diagrams and Poisson disc distributions.