Matthias Richter
8b30af1385
Refactor: Remove shape ids in main module.
2012-10-09 00:50:46 +02:00
Matthias Richter
ed495d3306
Report collisions immediately instead of collecting first.
...
Collecting collisions and then reporting leads to confusing behavior
when a previous collision callback resolved the collision, e.g.
platforms in jump in runs pushing the player upwards when standing on
two platforms at the same time.
2012-10-08 13:48:30 +02:00
Matthias Richter
de82e88ddf
Add HC:shapesInRange(x1,y1, x2,y2)
...
Returns a set of shapes that are enclosed in the rectangle
(x1,y1)-(x2,y2).
2012-07-10 16:35:27 +02:00
Matthias Richter
317cce31c6
Add HC:addShape(shape).
...
Shape must have at least two functions:
- shape:bbox()
must return an axis aligned bounding box of the shape
- shape:collidesWith(other)
must return false, ... if the two shapes do not collide
must return true, sx, sy if the two shapes collide, where sx,sy is the
separation vector from from shape to other.
Convex shapes can use the supplied GJK algorithm. In that case the shape
must implement shape:support(dx,dy) which returns the point of the shape
that lies furthest in the direction of dx,dy.
2012-07-10 16:29:59 +02:00
Matthias Richter
f1ad856da9
Remove Spatialhash:getNeighbors() in favor of :inRange()
2012-07-10 16:21:33 +02:00
Matthias Richter
1280b0a2d4
Use hash:rangeIter() in HC:update()
2012-07-10 16:19:27 +02:00
Matthias Richter
b20fc496eb
Add shape:scale(s).
2012-07-05 17:30:13 +02:00
Matthias Richter
ea49f9df8b
Issue #14 : Remove usage of collision ID.
2012-06-10 14:24:30 +02:00
Matthias Richter
e03ea9b0a2
Spatial hash to use number instead of table arguments
2012-05-30 15:27:09 +02:00
Matthias Richter
5b12e72aae
Switch to light vector module
2012-04-12 16:07:50 +02:00
Matthias Richter
8a182a902f
Rename HC:testPoint to HC:shapesAt. More efficient implementation.
2012-03-05 10:37:36 +01:00
Matthias Richter
1fd4dff37e
Merge remote-tracking branch 'technocat/master'
2012-03-05 10:32:51 +01:00
Matthias Richter
a7c65630ef
Iterators for active and neighboring shapes.
2012-03-05 10:26:14 +01:00
Danny "TechnoCat" Fritz
b58631465c
Added HC:testPoint(x, y) -- Test point for collisions with active objects.
2012-03-03 20:06:39 -06:00
Matthias Richter
ac27eee778
Fix HC:remove(shape, ...) to accept varargs.
2012-02-20 10:54:07 +01:00
Matthias Richter
940266e0dc
Add shape:bbox(). Simplify hash aware functions
2012-02-11 19:38:09 +01:00
Matthias Richter
d8af7e3d2d
Fix typo in HC:clear(): self._hash instead of self.hash.
2012-01-29 14:19:59 +01:00
Matthias Richter
c681391033
Fix triangulation. Use class-commons. Add hash:draw()
...
Polygon triangulation bug:
In some cases Kongs triangulation algorithm produces triangles
with collinear points. The Polygon constructor removes one of
these and throws an error because there are not enough vertices.
Checking if the current points in a triangulation step are
collinear and discarding those triangles fixes the problem.
Class-commons lets you use any supporting class system as
backend for HC.
Add SpatialHash:draw() for debug purposes.
2012-01-22 00:09:54 +01:00
Matthias Richter
ab08c5744b
Silly me, Lua doesn't work this way
2011-11-13 16:00:08 +01:00
Matthias Richter
956df262d5
Avoid using module(). Make main module a class.
2011-11-13 14:15:46 +01:00
Matthias Richter
5aa6b335be
Add HC.clear()
2011-08-12 13:00:54 +02:00
Matthias Richter
06dc6bed68
Merge start and persits callback. Add HC.setPassive
2011-06-03 18:06:42 +02:00
Matthias Richter
787c980fdd
Add point shape
2011-02-26 17:27:04 +01:00
Matthias Richter
36fb13a69a
SpatialHash to return set instead of array
2011-02-10 14:36:10 +01:00
Matthias Richter
7803b0c11b
Fix bug: param `times' ignored in setAutoUpdate()
2011-02-07 19:02:41 +01:00
Matthias Richter
476907a516
Add number parameter to setAutoUpdate()
2011-02-07 17:38:22 +01:00
Matthias Richter
75ea879e90
Check for shape validity in main module and hide submodules
2011-02-06 00:25:20 +01:00
Matthias Richter
ec10437644
Performance tweaks
2011-02-02 21:04:00 +01:00
Matthias Richter
ae58b7e822
Add auto update hook
2011-02-01 23:39:59 +01:00
Matthias Richter
4a24422e54
Fix reference errors
2011-01-18 23:33:11 +01:00
Matthias Richter
b8c4462454
Rename file
2011-01-18 18:59:25 +01:00
Matthias Richter
f28685bc16
Make proper lua modules
2011-01-18 18:55:51 +01:00
Matthias Richter
e43125d4b8
Add groups and permeable shapes
2011-01-18 15:04:27 +01:00
Matthias Richter
d79755d11e
Make main module agnostig of shape._type
2011-01-16 17:10:35 +01:00
Matthias Richter
4ceac7040a
Rename adding functions
2011-01-14 23:25:24 +01:00
Matthias Richter
940fc40f8e
Fix package path problem
2011-01-13 16:28:05 +01:00
Matthias Richter
7a67c3f924
Fix errors in spatial hash coordinates
2011-01-13 16:15:35 +01:00
Matthias Richter
3ad0242195
Initial commit
2011-01-13 14:38:36 +01:00