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 rotation/translation to lines raycasting example #25042

Merged
merged 6 commits into from
Dec 7, 2022

Conversation

bergden-resonai
Copy link
Contributor

@bergden-resonai bergden-resonai commented Nov 30, 2022

Related issue: #24405

Description

@MixMasterMitch fixed the bug and suggested an easy modification to the example to show the bug
I think the example is cooler* this way, and now it'll be easier to catch similar bugs
Had to move some things around to make things available on the right(?) scopes

The animation code is borrowed from the clipping / stencil example

This contribution is funded by Resonai and @MixMasterMitch

*Moral justification for this pull request(?):
image

Comment on lines +57 to +95
const raycaster = new THREE.Raycaster();

raycaster.params.Line2 = {};
raycaster.params.Line2.threshold = 0;

const matLine = new LineMaterial( {

color: 0xffffff,
linewidth: 1, // in world units with size attenuation, pixels otherwise
worldUnits: true,
vertexColors: true,

//resolution: // to be set by renderer, eventually
alphaToCoverage: true,

} );

const matThresholdLine = new LineMaterial( {

color: 0xffffff,
linewidth: matLine.linewidth, // in world units with size attenuation, pixels otherwise
worldUnits: true,
// vertexColors: true,
transparent: true,
opacity: 0.2,
depthTest: false,
visible: false,
//resolution: // to be set by renderer, eventually

} );

const params = {

'line type': 0,
'world units': matLine.worldUnits,
'visualize threshold': matThresholdLine.visible,
'width': matLine.linewidth,
'alphaToCoverage': matLine.alphaToCoverage,
'threshold': raycaster.params.Line2.threshold,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same code, just moved to the file's scope

@Mugen87 Mugen87 added this to the r148 milestone Nov 30, 2022
@mrdoob mrdoob merged commit 2151e4c into mrdoob:dev Dec 7, 2022
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