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

Optimization for when no constraint is used #566

Open
wants to merge 53 commits into
base: master
Choose a base branch
from

Conversation

bchevalier
Copy link
Contributor

Optimized out calls to Constraint API when no constraint has been defined.

Includes #556

Grid.clear = function(grid, bodies) {
grid.buckets = [];
for (var i = 0; i < bodies.length; i++) {
bodies.pairs.length = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is supposed to be bodies[i].pairs.length = 0

@finscn
Copy link

finscn commented Apr 2, 2020

@liabru , Is there any plan for merging this PR ?

@NikhilVerma
Copy link

NikhilVerma commented May 29, 2020

One issue I am facing with this PR is that when a body is added out of bounds Grid.addBodies aborts adding a region. However Grid.update will still read the region of the body and throw a JS error.

Another issue I am seeing is that in SAT._overlapAxes and Projections.verticesOntoAxes we loop over axes and projections and then read the other value with the same index. However axes and projections are not guaranteed to have the same length. You can see we limit the precision inside Axes.fromVertices

After fixing those issues (just continue; the loop I get a much more stable demo for my project)

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

Successfully merging this pull request may close these issues.

None yet

5 participants