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 PointerControls #30502

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Add PointerControls #30502

wants to merge 3 commits into from

Conversation

zakarialaoui10
Copy link

I’m currently working on Ziko-gl, an addon for Ziko.js built on top of Three.js, and I’ve added PointerControls to it. Now, I’m considering integrating it into the core library.

PointerControls is used to enable interaction with 3D objects in the scene by detecting pointer events such as hoveron, hoveroff, click, and pointerup. These events allow you to interact with objects by hovering over them, clicking on them, or releasing the pointer

hovered : null,
selected : null,
intersections : []
}

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (90% of all statements in
the enclosing function
have an explicit semicolon).
orbit.update();
orbit.addEventListener( 'change', render );
// world
const objects = []

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (94% of all statements in
the enclosing function
have an explicit semicolon).
pointer.addEventListener("hoveron", e=> {
e.object.matrixAutoUpdate = true;
transform.attach(e.object);
})

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (94% of all statements in
the enclosing function
have an explicit semicolon).
@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 12, 2025

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 12, 2025

It seems the demo is broken since it is not possible to transform objects via TransformControls.

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 12, 2025

It seems you have extracted the selection logic from DragControls into an own module.

I'm not sure it's a good idea to call the module PointerControls since it does not really control the camera or any objects. It's more or less a middleware for other controls. And for that it is maybe too applications specific.

E.g. the transformGroup and recursive properties are specific to drag controls and they are not appropriate for all use cases, see #26134.

I have the feeling it's better to put this into a third-party repo first and only add it into the core if we see it is commonly used.

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.

2 participants