func (ray *Ray) FindAnyIntersect(blocks mapgen.BlockSource, boxes []*Box) (*vmath.Vec3, int) { pos := ray.pos for dist := 0.0; dist < RAY_MAX_DIST; dist += RAY_PRECISION { pos.Translate(&ray.dir, RAY_PRECISION) for i, v := range boxes { if v == nil { continue } if !v.Contains(pos) { continue } return &pos, i } wc := coords.World(pos) if blocks.Block(wc.Block()).Solid() { return &pos, -1 } } return nil, -1 }
func (es *EntityState) Wpos() coords.World { return coords.World(es.Body.Pos) }