Offset Contour Function Help

I was looking to follow this example and offset a simple square by a given distance:

I have this codesandbox test environment:

https://codesandbox.io/p/sandbox/63h94y?file=%2Fsrc%2Findex.mjs%3A180%2C1

I am running into this error:

TypeError

shiftMatrix.applyToBufferAttribute is not a function

What is the expected input into this function? Is it the Three.Vector2 points?

I could not find any methods in the threeJS documentation that have applyToBufferAttribute().

Thanks for your help!

The applyToBufferAttribute has been deprecated 4 years ago (in r113). You may need to either use an old Three.js release, or to find alternative ways to do the same matrix operation on a buffer. Have you tried to use BufferAttribute.applyMatrix3 or BufferAttribute.applyMatrix4?

3 Likes

Thank you, applyMatrix4 does the trick.

3 Likes