Can someone help me with the following code snippet?
export class LandingPageComponent implements OnInit {
scene: THREE.Scene;
(...)
ngOnInit() {
this.scene = new THREE.Scene();
var loader = new THREE.JSONLoader();
loader.load("../../assets/fire_lion.json",function ( obj ) {
this.scene.add(obj); // Issue here
});
I have a defined and functioning scene, but I encounter an error when trying to execute this code. The error indicates that the scene is not declared, which makes sense as "this" no longer refers to the class. How can I resolve this and successfully add the object to the scene?
Thank you in advance for your assistance!
PS: Attempting to use ObjectLoader results in an error message prompting me to utilize JSONLoader.