Skip to content

[Veinminer] Smarter search #17

@Derpius

Description

@Derpius

Context

The current search algorithm is perfectly valid, but produces results that can look “wrong” to players. This is because the offsets are hardcoded world directions.

Proposed solution

  • Treat the offsets as local vectors in a broken block face’s TBN coordinate system
  • When a user breaks a block, get the normal of the face that the user mined (this should be possible, but might need a raycast instead of being returns)
  • To calculate the bitangent (and by extension the tangent), use the following rules:
    • If the face is vertical, the bitangent is always up
    • If the face is horizontal, the bitangent is the up vector of the player’s camera, with y set to 0 and normalised, and then rounded to the nearest orthogonal direction
  • Use these vectors to transform the local offsets to world vectors

Once the above work is complete, we’ll likely also need to order the offset tables better to produce a more hand-crafted result

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions