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

Line2: Incompatibility with TransformControls and OutlinePass #30718

Open
Lucas0819 opened this issue Mar 11, 2025 · 0 comments
Open

Line2: Incompatibility with TransformControls and OutlinePass #30718

Lucas0819 opened this issue Mar 11, 2025 · 0 comments
Labels

Comments

@Lucas0819
Copy link

Description

The Line2 object's position itself is not adjusted; instead, it is implemented through the geometry.setPositions method. This causes discrepancies when using TransformControls to move it or applying OutlinePass for outlining, where the selected position does not align with the actual line.

Expected Outcome: Fix the issue, or provide the correct way to handle Line2 so that TransformControls defaults to selecting the bounding box center of the line segment.

Thanks.

Reproduction steps

1.create a Line2 object and set multiple points that are not at the origin
2.select the Line2 object using TransformControls or OutlinePass

Code

  const lineGeometry = new LineGeometry();
  lineGeometry.setPositions([1, 1, 1, 2, 2, 2, 2, 0, 2]);
  const lineMaterial = new LineMaterial({color: 0xff0000,linewidth: 1});
  const line = new Line2(lineGeometry, lineMaterial);
  scene.add(line);

  const transCtrl = new TransformControls(camera, renderer.domElement);
  scene.add(transCtrl.getHelper());

  // controls' position is wrong
  transCtrl.attach(line);

Live example

https://codesandbox.io/p/sandbox/5h3zmt

Screenshots

use with OutlinePass:
Image

use with TransformControls:
Image

Version

"three": "0.174.0"

Device

Desktop

Browser

Chrome

OS

MacOS

@Mugen87 Mugen87 added the Addons label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants