As a newcomer to three.js, I have been working on creating a bowling game. However, I am encountering an issue where I need to access a function from my "Application" class within the physics class that I have created.
Here is a snippet of the Application Class:
export class Application {
constructor() {
this.objects = [];
this.createScene();
}
createScene() {
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(60,
window.innerWidth / window.innerHeight, 1, 10000);
this.renderer = new THREE.WebGLRenderer();
this.renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(this.renderer.domElement);
this.render();
}
getMesh(){
return this.curveObject;
}
update(){
}
render() {
requestAnimationFrame(() => {
this.render();
});
this.objects.forEach((object) => {
object.update();
});
this.renderer.render(this.scene, this.camera);
}
}
And here is the Animate Function inside the "Physics" class:
animate(){
if (this.pinTest){
// console.log(this.pinTest);
this.pin1Mesh.position.copy(this.pin1Body.position);
this.pin1Mesh.quaternion.copy(this.pin1Body.quaternion);
this.pinTest.position.copy(this.pin1Body.position);
this.pinTest.quaternion.copy(this.pin1Body.quaternion);
}
// Now I am looking for a way to execute the render function here
//this.renderer.render(this.scene, this.camera);
}