Daddy needs a new pair of RAM!

edit: the fps are way better in smaller terminal windows with lower character count but then it's hard to make out the dice. D:

edit2: code here (expires in 2 weeks)

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 9 points 5 days ago (2 children)

I can easily check for when motion stops, but checking for when any particular face is both parallel to the floor and at the same level can be computationally expensive, particularly in the dice with more sides. What you're suggesting is likely a good idea, but I wouldn't know how to get probabilities without doing what I just mentioned. I'm sure there's an optimization i can do with this that I can't think of rn.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 3 days ago*

    Cross products! If you take the cross product of two edges of a face, you get a perpendicular vector for that face. It shouldn’t be too bad to do 20 of those per frame to find if a face is level with the ground (cross product points straight up and/or down depending on how you’re doing them)… now I don’t know about the velocity/acceleration numbers (including rotation)…

  • source
  • parent
  • [–] 8 points 5 days ago* (1 child)

    maybe just "if velocity < 0.01, find which side is closest to the floor, and if its within 1mm of the floor, take the opposite side (the one facing up) as the answer"

    The only edge case I can think of is if it gets close to balancing on an edge, and then finally tips over to one side or the other. But in that case I don't think the face closest to the floor would be within 1mm of the floor, so it should still work.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 6 points 5 days ago (1 child)

    that's how it's implemented, mostly, but sometimes dice "stop" while they're still tilted and standing on a corner (and then roll back down, possibly going back more than 1 face) so there's also that.

  • source
  • parent
  • hideshow 2 child comments