Skip to content

How to get full particle buffers? (particleSystem.GetPositionBuffer(), etc) #22

Discussion options

You must be logged in to vote

I can't believe I figured this out because I don't fully understand it, but I figured it had to be something with reifying the Array using the pointer to the head b2Vec2. Sure enough:

const b2Vec2Size = Float32Array.BYTES_PER_ELEMENT * 2;
const count = particleSystem.GetParticleCount();
const pbPointer = getPointer(particleSystem.GetPositionBuffer());
const positionArr = b2d.reifyArray(pbPointer, count, b2Vec2Size, b2Vec2)

that seems to do the trick.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SammyJoeOsborne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant