Literally the CollisionGrid.

 
Stuchlik: Yeah, I get the high level function of the grid by what you’re saying I think, just not sure about how to get there, just going to read that code though thanks

Stuchlik: Cool i’ll start that then i guess

Ransone: It depends on projects and etc. other people have other conventions

Stuchlik: Fair, I learnt python briefly and people were pretty shirty with layout etc 😛

Scarfi: If I have Array Object, Object, Object, Object stored in a variable called x

Tandetzke: How do i access properties in the object

Kostka: Actually that comment that says it must be larger than the entity’s max size is inaccurate. it needs to be larger than the entities max size + the max distance an entity can travel in a frame

Stuchlik: Tcsc: cool, entities particles in my thing are randomly sized at the moment, though Ill start with just a 3×3 grid or something maybe.

Usman: Django_: you can access an array’s element with arrindex. so x0 gets the first element of the array

Finey: Oh, dividing the world into thirds?

Battaglia: Yeah that would be plenty

Usman: Django_: and if x0 is an object then you can access its properites like you would anything else, via .property

Coello: The way this works though you’d probably loose all benefits

Usman: Django_: x0.prop reads .prop from the object stored at x0

Silverthorn: Since it checks every neighboring cell to an entity

Drewski: Usman: i essentially wanna take the xi.prop and sort it

Stuchlik: Tcsc: i was just thinking v simple grid to start with I guess.

Usman: The array of objects django_?

Verdi: You probably could do the n2 approach for this tbh, since you only have a few particles.

Stuchlik: Tcsc: as in – it’s the concept I’m trying to understand rather than make something that actually works well at teh mo :

Wakley: Django_: Array.prototype.sort – JavaScript MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort

Usman: Django_: in your sort function, you’ll use a.prop and b.prop instead of just a and b

Stuchlik: There’s no end user waiting here haha

Usman: Django_: but the sort is basically the same otherwise

Usman: Django_: if a.prop b.prop { return -1; } if a.prop b.prop { return 1; } return 0;

Campora: Usman: i have an array of strings called jsonData, i do: jsonDatai.split/s+/ and it doesnt split it

Habibi: Also tried: jsonDatai = jsonDatai.split/s+/.sort;

Stuchlik: Tcsc: I’m not following too well what ‘cellsize’ would actually be with this. this.cellSize = cellSize; , but I can’t see anywhere that’s p***ed / defined. It looks as though there’s one cell for every pixel for var i = 0; i width * height; ++i {this.cells.push;} I’m not too sure though.

Rachal: Width and height are in cells.

Jeavons: So you’d do 3, 3, Math.ceilMath.maxwidth/3, height/3

Saltzgaber: When in doubt use too many cells.

Stuchlik: You’d do 3, 3, Math.ceilMath.maxwidth/3, height/3 —- this is when initializing the grid ?

Stuchlik: I should probably read about prototyping, I’ve never used them and I don’t know what the point of them is at the mo

Toan: I’m using it there as cl***es in js

Washinski: E.g. the functions on foo.prototype.bar are methods

Deasis: Err, on foo.prototype

Stuchlik: AFAIK it’s like altering the blueprint of something after it’s made, or something like that

Medlin: It is, but thats not what i’m doing here.

Fresquez: Does anyone use uglify with grunt? I’m curious what the ‘my_target’ bit indicates? http://sprunge.us/KMKg?js

Swerdloff: I’m not sure why you’d have multiple targets

Hosford: Literally the CollisionGrid is a cl***, and then addEntity, removeEntity, etc. are methods. i make a collision grid with new CollisionGridw, h, c and then call those methods on it.