Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Issue: #329
Users are hitting the fatal error
Uncaught TypeError: class constructors must be invoked with 'new' when trying to create Physijs Scene
with recent versions of Three.js. This is due to the outdated inheritance method used byTHREE.Scene.call( this, params )
.Solution
Update to ES6 classes, everywhere. Also, convert Eventable to be a mix-in. This should make Physi.js basically compatible with the current version of Three.js (r143). This is a giant diff, converting all classes to ES6 at once, because of compatibility issues between ES6 classes (prototype read-only) and the old inheritance method (modifies prototype).
Please review the file side-by-side with the current physi.js, locally in two editor windows, as the Git diff computed very poorly, despite there being no changes to business logic. The number of lines changed is in the dozens, not 1,000.
Testing
Ran my personal project (https://github.com/paxorus/physi-creator) which uses Scene and several Mesh types with this version of the code. The error was gone.