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

Check never returns multiple collisions. #52

Closed
lucassardois opened this issue Mar 11, 2019 · 1 comment
Closed

Check never returns multiple collisions. #52

lucassardois opened this issue Mar 11, 2019 · 1 comment

Comments

@lucassardois
Copy link

lucassardois commented Mar 11, 2019

Hello,

It seems that the check function never returns multiples collisions when they occurs. It always only return the first one.

function Clone:move(vx, vy)
  local xx = self.x + vx
  local yy = self.y + vy
  local nx, ny, cols, len = self.world:check(self, xx, yy)

  if self:isGoingUp(vy) then
    for i = 1, len do
      local col = cols[i]
      local other = col.other
      if col.normal.x == 0 and other.isClone then
        other:move(0, vy)
      end
    end

   -- Make the player "stick" to the entity it just pushed
   ...
  end

  self.x, self.y = x, y
  self.world:update(self, x, y)
end
@lucassardois lucassardois changed the title check doesn't Check never returns multiple collisions. Mar 11, 2019
@lucassardois lucassardois reopened this Mar 11, 2019
@lucassardois
Copy link
Author

More news : I found out that calling check or project return differents results for the number of collisions for the same parameters.

_, _, cols1, len1 = self.world:check(self, goalX, goalY)
cols2, len2 = self.world:project(self, self.x, self.y, self.w, self.h, goalX, goalY)

Here len1 ~= len2

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