Bending a text object in ThreeJS

There is this repo for this example, which is almost 2 years old and therefore does not work with the latest releases of three JS.

I get the following errors and warnings.

error: THREE.Matrix3.getInverse no longer takes a Matrix4 argument.

warning: THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0

Not sure if due to errors and warnings I get, but the result of the bend is also incorrect ( screenshot ).

I tried to change the axis of the bend, but no luck.

How can I change this libray to work with recent versions of 3JS, or is there an alternative way to bend text, as shown in the example of the above repo?

+1
source share
1 answer

THREE.js , BendModifier.js script.

var InverseP = new THREE.Matrix3().getInverse( P );

newVertices[i] = new THREE.Vector3(); newVertices[i].copy( geometry.vertices[i] ).applyMatrix3( InverseP );

Matrix4 - :

var InverseP = new THREE.Matrix4().getInverse( P );

newVertices[i] = new THREE.Vector3(); newVertices[i].copy( geometry.vertices[i] ).applyMatrix4( InverseP );

three.min.81.js, .

+1

Source: https://habr.com/ru/post/1569504/


All Articles