Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 month ago by AuroraGuide364

What is the Expected Input for applyToBufferAttribute() in the Three.js OffsetContour Function?

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I'm trying to offset a simple square using the OffsetContour function (more Resources) as shown in the example below:

JAVASCRIPT
function OffsetContour(offset, contour) { let result = []; offset = new THREE.BufferAttribute(new Float32Array([offset, 0, 0]), 3); for (let i = 0; i < contour.length; i++) { let v1 = new THREE.Vector2().subVectors(contour[i - 1 < 0 ? contour.length - 1 : i - 1], contour[i]) } }``` I set up a test environment in codesandbox: <https://codesandbox.io/p/sandbox/63h94y?file=%2Fsrc%2Findex.mjs%3A180%2C1> However, I encounter the following error: > TypeError > shiftMatrix.applyToBufferAttribute is not a function This leads me to ask: What is the expected input for this function? Is it expecting THREE.Vector2 points? I couldn’t find any methods named applyToBufferAttribute() in the Three.js documentation. Thanks for your help!
6

Comments 0

Answers 0

Views 38

0 Answers

Discussion

No comments yet.