@yandeu_ hey I'm using https://t.co/BX4AK23rnW I see that "You can only set the position (and rotation) at any moment if it the body is of type kinematic. " what if I want to teleport my character which reacts to gravity etc? Props for nice project thought....
— Ronalds Mazītis (@LV88H) August 2, 2022
class MainScene extends Scene3D {
async create() {
for (let step = 0; step < skins.length; step++) {
setInterval(greet, 8000);
this.man = new ExtendedObject3D()
this.man.name = 'man'
this.man.rotateY(Math.PI + 0.1) // a hack
this.man.add(man)
function greet() {
this.man.position.set(vertibasx, vertibasy, vertibasz)
// CANNOT ACCESS THIS.MAN.POSITION
}
}
}
}
//this does not work too
class MainScene extends Scene3D {
async create() {
for (let step = 0; step < skins.length; step++) {
this.man = new ExtendedObject3D()
this.man.name = 'man'
this.man.rotateY(Math.PI + 0.1) // a hack
this.man.add(man)
setInterval(greet, 8000);
function greet() {
this.man.position.set(vertibasx, vertibasy, vertibasz)
// CANNOT ACCESS THIS.MAN.POSITION
}
}
}
HOW DOES JAVASCRIPT FIXES THIS. ISSUE?.
*****************************************
BIG FIX THAT STILL LEADS TO ERROR DUE THREEJS
class MainScene extends Scene3D {
async create() {
for (let step = 0; step < skins.length; step++) {
this.man = new ExtendedObject3D()
this.man.name = 'man'
this.man.rotateY(Math.PI + 0.1) // a hack
this.man.add(man)
let that = this.man;
}
setInterval(greet, 8000);
function greet() {
that.position.set(vertibasx, vertibasy, vertibasz)
//THIS LEADS TO WHITE SCREEN AS GREET HAPPENS, CONSOLE
//LOGS HERE, BUT POSITION CANNOT BE SET EVERY 8 SECONDS
}
}
}
**********************************
for example ----
class MainScene extends Scene3D {
async create() {
for (let step = 0; step < skins.length; step++) {
this.man = new ExtendedObject3D()
this.man.name = 'man'
this.man.rotateY(Math.PI + 0.1) // a hack
this.man.add(man)
}
console.log("try", window.localStorage.getItem('x'));
///leaves undefined "try"
setInterval(greet, 8000);
function greet() {
this.man.position.set(vertibasx, vertibasy, vertibasz)
// CANNOT ACCESS THIS.MAN.POSITION
}
}
}
Nav komentāru:
Ierakstīt komentāru