Matter-js: How to make smoke particles?

Created on 2 Feb 2016  路  4Comments  路  Source: liabru/matter-js

I'm creating a side-scrolling game using Matter.JS, in this game one of heros is made of fire, so he needs to get some smoke, but I dont know how to make particles floating in the air, how I can make a float body in Matter.JS?

I want something like this: https://www.youtube.com/watch?v=b-QhKcae-6E

Please see my codepen here: http://codepen.io/vanuatu/pen/VeQMpp

question

Most helpful comment

What you're looking for is a particle system. There's nothing currently built in to the engine for this, it's more of something you'd find in a game engine so it's a bit out of scope.

You could build your own by to defining a particle object (position, velocity, lifetime etc) and then use the engine update event to update the particle positions, then render them to the same canvas as the physics objects. The built in body type could be somewhat reusable for this (don't add it to the world, instead create your own particle world).

All 4 comments

What you're looking for is a particle system. There's nothing currently built in to the engine for this, it's more of something you'd find in a game engine so it's a bit out of scope.

You could build your own by to defining a particle object (position, velocity, lifetime etc) and then use the engine update event to update the particle positions, then render them to the same canvas as the physics objects. The built in body type could be somewhat reusable for this (don't add it to the world, instead create your own particle world).

thanks for the clear explanation, @liabru

No problem!

I created a fake smoke effect by using spheres and a PNG of something that resembles (black) smoke.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TimuJiang picture TimuJiang  路  4Comments

mrspeaker picture mrspeaker  路  3Comments

djipco picture djipco  路  4Comments

elrodsj picture elrodsj  路  3Comments

koko236 picture koko236  路  3Comments