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

Move arcball target as user translates camera #554

Merged
merged 2 commits into from
Feb 20, 2024
Merged

Conversation

kephale
Copy link
Member

@kephale kephale commented Feb 19, 2024

pivoting_arcball.mp4

This PR updates sciview so when the user translates the camera the target of the arcball moves. The previous behavior would jump the user back to the previously selected mode when rotating the camera.

Closes: #541

@kephale kephale merged commit 514a33e into main Feb 20, 2024
3 of 4 checks passed
@kephale kephale deleted the arcballreset-movement branch February 20, 2024 02:29
// Assuming SciView has a method to get the camera and its position
// And assuming 'targetArcball' is a feature of SciView you want to update
val currentDistance = sciview.targetArcball.distance // Example to access current distance
val newTargetPosition = cameraNode!!.spatial().position + cameraNode.forward.mul(currentDistance, Vector3f())
Copy link
Contributor

Choose a reason for hiding this comment

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

this is nice! I was asking myself how one would preserve the distance to the arcball-ing centre, and by how to update/shift that centre based on the distance to the cam (perspective proj.)... the solution above is cool and a robust way of doing it!

@@ -286,6 +286,8 @@ class Properties : InteractiveCommand() {
}

// update property fields according to scene node properties
sciView.setActiveNode(currentSceneNode)
println("referschSceneNodeInDialog")
Copy link
Contributor

Choose a reason for hiding this comment

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

here's maybe one printout forgotten to clutter one's console :-)

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.

Follow up on Controls improvements
2 participants