Skip to content

Critical Bug of getInverse when I use arrowHelper! #13188

@yiakwy

Description

@yiakwy
Description of the problem

Hello I am developing a 3d system and it generates a lot arrowHelper programmatically. The issue is that every few seconds, a warning "THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0" be fired.

from = new THREE.Vector3(-edge.start.x, 0.1, -edge.start.y)
to = new THREE.Vector3(-edge.end.x, 0.1, -edge.end.y)
dir = to.clone().sub(from)
len = dir.length()
arrowHelper = new THREE.ArrowHelper(dir.normalize(), from.clone().sub(shift), len, color)
arrowHelper.children[1].scale.set(1,1,1)

those huge I/O operations (console.log) might run out the memory of my browser.

When I dived into the codes, I believe that there is a bug or misunderstanding in the codes

getNormalMatrix: function ( matrix4 ) {

   return this.setFromMatrix4( matrix4 ).getInverse( this ).transpose();

},

The warning comes from getinverse showing me that it is trying to call a matrix3, however in fact, it is calling matrix4 and of course compared to matrix3, matrix4 contains a lot of zeros.

I don't think this is an intended behavior. Wish you can help me out of warnings.

Three.js version
  • Dev
  • r89
  • ...
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, ...)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions