So I can import three-steer using this repo https://github.com/AlexusBlack/three-steer I've taken the main file with the Entity and SteeringEntity classes and saved in my src.
With some tweaks, I needed to add
import * as THREE from 'three';
To the beginning of the file and change
module.exports = { Entity, SteeringEntity };
to
export { Entity, SteeringEntity };
Then I can import in my main.js using
import { SteeringEntity } from './three-steer';
Now I can import it fine, but when I go to implement using
let entity = new SteeringEntity(mesh); scene.add(entity);
I get the following error
three-steer.js:11 Uncaught (in promise) TypeError: Class constructor Group cannot be invoked without 'new'
The line causing the issue is (in Entity class)
THREE.Group.apply(this);
Couldn't find any docs for THREE.Group.apply, is it outdated code? What's the purpose of it?
Would love to update it, I tried this but got another error
const group = new THREE.Group(); group.add(this);
Error
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'remove')
Hello again
So I can import three-steer using this repo https://github.com/AlexusBlack/three-steer I've taken the main file with the Entity and SteeringEntity classes and saved in my src.
With some tweaks, I needed to add
import * as THREE from 'three';
To the beginning of the file and changemodule.exports = { Entity, SteeringEntity };
toexport { Entity, SteeringEntity };
Then I can import in my main.js usingimport { SteeringEntity } from './three-steer';
Now I can import it fine, but when I go to implement using
let entity = new SteeringEntity(mesh); scene.add(entity);
I get the following error
three-steer.js:11 Uncaught (in promise) TypeError: Class constructor Group cannot be invoked without 'new'
The line causing the issue is (in Entity class)
THREE.Group.apply(this);
Couldn't find any docs for THREE.Group.apply, is it outdated code? What's the purpose of it? Would love to update it, I tried this but got another error
const group = new THREE.Group(); group.add(this);
ErrorUncaught (in promise) TypeError: Cannot read properties of undefined (reading 'remove')