Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/manual/introduction/How-to-update-things.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ <h3>[page:BufferGeometry]</h3>
<code>
line.geometry.attributes.position.needsUpdate = true; // required after the first render
</code>

<p>
If you change the position data values after the initial render, you should also call
`.computeBoundingSphere()` on the object to recalculate it's bounding sphere.
The bounding sphere is used in calculations such as raycasting and frustrum culling.
If this method id not called after vertices are changed, you are likely to run into
strange side effects due to Three.js failing to properly identify the correct boundary
of your object. This may cause bugs succh as an object that doesn't properly
recieve raycasts on the entire object, or is frustrum culled too
early (such as when close to the edge of the screen).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a tutorial, so just the first sentence is all that is necessary.

@Mugen87 Maybe there are better places to mention this...

Copy link
Collaborator

@Mugen87 Mugen87 Jun 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, I thought the pages in the manual section (not the API reference) have actually tutorial/guide character. Seems to be the right place for it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need to emphasize bugs that can result from logic errors on the part of the user.

The most accurate statement is something like:

If you change the position data values after the initial render, you may need to call .computeBoundingSphere() to recalculate the geometry's bounding sphere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestions! Updated accordingly.

</p>
<code>
line.geometry.computeBoundingSphere(); // recommended after the first render
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"recommended after the first render" is misleading. Please remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, use cases will vary and is not always required. Updated accordingly.

</code>

<p>
[link:http://jsfiddle.net/w67tzfhx/ Here is a fiddle] showing an animated line which you can adapt to your use case.
Expand Down