Why i can't get this in requestAnimationFrame

As title.

I try to rotate a group by animationMixer.
but after i set “this.mixer=mixer”, the self.mixer condition still false.
i ensure i bind this by const self.
Is there any problem with this sentence?
Thanks All.

Without the possibility to try the code, some guesses are:

  • this in animate and this in doRotateByCubeArray have different values
  • animate is called before doRotateByCubeArray, so this.mixer is not set yet
  • something else

You can check which of the three guesses is correct by printing their values:

animate( ) {
   console.log( 'animate', this );

doRotateByCubeArray(...) {
   console.log( 'doRotateByCubeArray', this );
1 Like

i solve it thanks!!
i setMixer to another class
then i bind it to work!

1 Like