Silentor / InfluenceTerrainDemo

Some experiments with zone-based terrain generation
4 stars 2 forks source link

Implement navigation on heightmap #97

Closed Silentor closed 5 years ago

Silentor commented 5 years ago

Based on #96. Actor height interpolated from heightmap vertices. Actor speed based on block material and block inclination. Prevent climb on very steep blocks. Take into account: combined blocks can have vertical side. Should I collapse vertical sides for overlapped blocks? Vertical sides can enrich map, but make raycasting/colliding/visualization far more complex (where should I store vertical part texture?)

Silentor commented 5 years ago

Write Barycentric2DCoords() and LineTriangleIntersection() optimized for grid triangles

Silentor commented 5 years ago

Implemented unit triangles barycentric 2d optimized calculation

Silentor commented 5 years ago

Ok, next step - take into account block material and block surface inclination to modify speed. And make steering along unpassable blocks. Steering leads to simplest contact resolution.

Silentor commented 5 years ago

There are some ways to calculate normals: 1) Per block - normal of block based on height of 4 adjacent blocks 2) Per block - normal of 8 adjacent blocks 3) Per block - average of normals of 4 height vertices (based on height of their adjacent vertices) 4) Per block - average of two normals based on normals of each triangle of quad 5) Per triangle - basically two normals per block based on each triangle (useful for very curved blocks) Need testing

Silentor commented 5 years ago

It looks like I don't need Block height to generate and store, because simulation mostly use a vertex mesh. So I can skip GenerateHeightmap step in Micromap and generate heightmap directly with the blocks. But it means two iterations on zone area :(

Silentor commented 5 years ago

Ok, next step - prevent actor to move on very steep and vertical blocks. Implement steering along impassable blocks

Silentor commented 5 years ago

Ok, simplest first person navigation works. Time to implement pathfinding