Help needed to convert an old script work with latest threejs

I found a nice flames example here at “three.js Animated Fire - JSFiddle - Code Playground”, with my limited knowledge I am trying to get it to work with latest version of threejs, but I keep getting errors. can someone point me in the right direction.

Error 1: Uncaught TypeError: Class constructor Mesh cannot be invoked without ‘new’
when I add new to the line the error changes to the following
Error 2: Uncaught TypeError: is not a constructor

any help is appreciated

yea so instead of

THREE.Fire = function ( fireTex, color ) {
... this, new THREE.BoxGeometry( 1.0, 1.0, 1.0 ), fireMaterial );

here you would need to do something like

class Fire extends THREE.Mesh {
    constructor( fireTex, color ) {
        super( new THREE.BoxGeometry( 1.0, 1.0, 1.0 ), fireMaterial );
1 Like

thanks makc3d…

ackshually, somebody already did this at github

1 Like

Thank you, that saved me a bunch!