Skip to content

@modoki/engine / index / parsePointsToPhys

Function: parsePointsToPhys()

parsePointsToPhys(src, ppm, minPoints?): Float32Array<ArrayBufferLike> | null

Parse an inline point list (polygon/mesh collider points) into a flat physics-space Float32Array. Accepts nested [[x,y],…] or flat [x,y,x,y,…] JSON (shared parser). Returns null on invalid JSON / a non-array / an odd flat length / < minPoints points.

Parameters

src

string

ppm

number

minPoints?

number = 2

Returns

Float32Array<ArrayBufferLike> | null

Built with Modoki.