Skip to content

How to implement grid-based particle collision detection as described in this Nvidia whitepaper? #3706

Answered by k-ye
bcolloran asked this question in Q&A
Discussion options

You must be logged in to vote

Oops. The immediate issue I can tell is that you cannot index into a vector (matrix) using a runtime integer variable yet. (The .indices[num_in_cell] part, as num_in_cell is a runtime variable). The current situation is a bit unfortunate, but we're really close on supporting it (@strongoier is driving this feature). For now a workaround is to do a static loop:

for vi in static(range(4)):
  if num_in_cell == vi:
    grid[ij].indices[vi] = p

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bcolloran
Comment options

@strongoier
Comment options

Answer selected by bcolloran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants