josephg / josephg/Chipmunk-js

Probably wrong context in SpatialIndex.prototype.collideStatic

Open
#24 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
539
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Probably wrong context is used in SpatialIndex.prototype.collideStatic.

SpatialIndex.prototype.collideStatic = function(staticIndex, func)
{
if(staticIndex.count > 0){
var query = staticIndex.query;

```
var self = this;

this.each(function(obj) {
// Wrong call: query(self, obj, new BB(obj.bb_l, obj.bb_b, obj.bb_r, obj.bb_t), func);
query.call(self, obj, new BB(obj.bb_l, obj.bb_b, obj.bb_r, obj.bb_t), func);
});
}
```

};

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating SpatialIndex.prototype.collideStatic and read the implementation of staticIndex.query alongside this.each. Trace which object should be the query receiver and compare that with the current invocation. Done means collideStatic uses the intended context and collision behavior is verified, preferably with an existing relevant test if one is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.