tts-community / tts-community-bug-tracker

Community maintained list of Tabletop Simulator bugs.
2 stars 0 forks source link

Physics.cast returns wrong order #31

Closed lefixx closed 3 years ago

lefixx commented 3 years ago

Describe the bug According to documentation "Entries are in the order of being hit." Note that direction of cast is from top to bottom.

To Reproduce

Steps to reproduce the behavior: Make a stack of three object and cast from a point of origin over them towards the table.

Doing this

hitList = Physics.cast({
    origin       = {-4, 7, 4},
    direction    = {0,-1,0},
    type         = 2,
    size = {2,2,2},
    max_distance = 6,
    debug        = true,
  })

  for i,v in ipairs(hitList) do
    print(hitList[i]["hit_object"].guid)
  end

Tabletop Simulator Info (please complete the following information):

https://user-images.githubusercontent.com/9057787/103459711-d5b71a00-4d19-11eb-81a7-69c1c2e21000.mp4

Benjamin-Dobell commented 3 years ago

I think this may be a documentation error, as opposed to a bug per se. In this case TTS is just exposing the results from Unity's RaycastAll (or rather RaycastNonAlloc) which states:

Note that the order of the results is undefined

It's probably best to submit a PR (or issue) against the docs (https://github.com/Berserk-Games/Tabletop-Simulator-API) and if required, sort the results yourself.

lefixx commented 3 years ago

Fixed in v13.0 according to notes "Fixed Physics.cast not returning list in correct order"