Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THREE.Group.apply(this); #5

Open
HJ959 opened this issue May 8, 2022 · 0 comments
Open

THREE.Group.apply(this); #5

HJ959 opened this issue May 8, 2022 · 0 comments

Comments

@HJ959
Copy link

HJ959 commented May 8, 2022

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 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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant