Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visual Octree Helper (#23478) #23481

Merged
merged 5 commits into from
Feb 18, 2022
Merged

Add visual Octree Helper (#23478) #23481

merged 5 commits into from
Feb 18, 2022

Conversation

carlssonk
Copy link
Contributor

@carlssonk carlssonk commented Feb 13, 2022

Simple visual Octree helper for showing a visual representation of the Octree data structure. Reference (#23478)

fps_example_show_octree

Usage:

import { Octree } from 'three/examples/jsm/math/Octree.js';
import { OctreeHelper } from 'three/examples/jsm/helpers/OctreeHelper.js'

const octree = new Octree();
octree.fromGraphNode("Your Group or Object3D model here");

const octreeHelper = new OctreeHelper(octree)
scene.add( octreeHelper )

Note: OctreeHelper should be instantiated after we call octree.fromGraphNode.

Let me know if anything can be imporved.

@Mugen87 Mugen87 added this to the r138 milestone Feb 14, 2022
@mrdoob mrdoob merged commit 98f4e4c into mrdoob:dev Feb 18, 2022
@mrdoob
Copy link
Owner

mrdoob commented Feb 18, 2022

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Feb 18, 2022

I've added it to games_fps:

const helper = new OctreeHelper( worldOctree );
helper.visible = false;
scene.add( helper );
const gui = new GUI( { width: 200 } );
gui.add( { debug: false }, 'debug' )
.onChange( function ( value ) {
helper.visible = value;
} );

Screen Shot 2022-02-17 at 8 50 56 PM

donmccurdy pushed a commit to donmccurdy/three.js that referenced this pull request Mar 10, 2022
* Add visual Octree Helper

* null pointer bugfix

* Refactor OctreeHelper.

* Update OctreeHelper.js

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants