mesh.rotate_*( ) & mesh.translate( ) move camera even though camera.position is specified
See original GitHub issueDescribe the bug, what’s wrong, and what you expected.
When applying rotations or translations to meshes, it seems like the camera moves around even though a camera.position is specified. This seems like undesired behaviour, as when I specify a camera I would like it to be fixed and not be influenced by a mesh being rotated or translated. Seems like even the axis changes sometimes (couldn’t get a screenshot this time).
Steps to reproduce the bug.
from pyvista import examples
filename = examples.planefile
plane = pv.read(filename)
# Alternate between different translations and rotations here
plane_mesh = plane.translate((100, 0, 100), inplace=False)
plane_mesh = plane_mesh.rotate_z(-30, inplace=False)
p = pv.Plotter()
p.show_axes()
p.add_mesh(plane, color=True, show_edges=True, opacity=0.5)
p.add_mesh(plane_mesh, color=True, show_edges=True, opacity=0.5)
p.camera.position = (0, 3000, 2000)
p.show()
System Information
--------------------------------------------------------------------------------
Date: Tue Aug 16 12:06:34 2022 CEST
OS : Darwin
CPU(s) : 8
Machine : x86_64
Architecture : 64bit
RAM : 16.0 GiB
Environment : Jupyter
File system : apfs
GPU Vendor : ATI Technologies Inc.
GPU Renderer : AMD Radeon Pro 560 OpenGL Engine
GPU Version : 4.1 ATI-4.8.54
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 05:57:50)
[Clang 11.1.0 ]
pyvista : 0.36.1
vtk : 9.1.0
numpy : 1.21.6
imageio : 2.21.1
appdirs : 1.4.4
scooby : 0.5.12
matplotlib : 3.5.2
IPython : 7.33.0
colorcet : 3.0.0
cmocean : 2.0
ipyvtklink : 0.2.2
scipy : 1.7.3
tqdm : 4.64.0
meshio : 5.3.4
jupyterlab : 3.4.4
--------------------------------------------------------------------------------
Screenshots
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
metal - Rotation, Translation and Default Camera Location
1 Answer 1 · There is no default location for the camera, other than the origin (0, 0, 0) if you want to...
Read more >Transformations, Coordinate Systems, and the Scene Graph
Here, we explore how to move objects around in 3D space using translation, rotation, and scale, and the coordinate systems which makes up...
Read more >Use Translations and Rotations - Babylon.js Documentation
Unlike position which sets the mesh to the values give translate moves the mesh in the given direction by the distance give and...
Read more >Camera - LearnOpenGL
First we set the camera position to the previously defined cameraPos . The direction is the current position + the direction vector we...
Read more >How to move the Camera in Blender (All possible ways)
The first and easiest way of moving a camera in Blender is using the tried ... G (Grab/translate) and R (Rotate) after selecting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In my example,
plane.center
is a sequence (X, Y, Z). You can use any point in space. Try(0, 0, 0)
to use the world origin.You have set the camera position, but have allowed the focal point of the camera to adjust based on the scene. Does the below do what you want? It sets the focal point on the center of the original
plane
.