Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems when using collision model #360

Open
ruichen0 opened this issue May 27, 2024 · 0 comments
Open

Problems when using collision model #360

ruichen0 opened this issue May 27, 2024 · 0 comments

Comments

@ruichen0
Copy link

``The problem occurred when I was using CollisionManagerGrid. When the add() was used, nothing added in to its buckets attribute.I monitored the conditions in the add(). Then I realized that the two rows:

for cell_idx in self._iter_cells_for_aabb(obj.cshape.minmax()):
     self.buckets[cell_idx].add(obj)

The second row did not run because the code in first line "Internal StopIteration". Then using the same data I monitored the func"self.iter_cells_for_aabb()". In the function, I realized that the value "iy_sup > self.rows" and "ix_sup > self.cols" is true, which is unexpected since it make "range(iy_lo, iy_sup)" in "for iy in range(iy_lo, iy_sup):" no longer running resulting from iy_lo bigger than iy_sup, which results to internal stop iteration because "the yield cell_id" won't run without the loop.
I use

width, height = director.get_window_size()
     self.cm = CollisionManagerGrid(0, width, 0, height, 40, 40)

to create the instance, according to the programming guide. However, the objects I wanted to add were outside the area because they are in a tiledmap which cannot be showed completely on the screen. I wonder if there is a solution? thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant