gpt4 book ai didi

python - 鼠洞 : 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm'

转载 作者:行者123 更新时间:2023-12-02 16:20:29 26 4
gpt4 key购买 nike

我正在尝试使用 ratcave for python 创建一个项目。但是当我导入 ratcave 时,出现以下错误:

AttributeError: 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm'

这是完整的堆栈跟踪:

Traceback (most recent call last):
File "PROJECT_PATH\src\main.py", line 2, in <module>
import ratcave as rc
File "PROJECT_PATH\venv\lib\site-packages\ratcave\__init__.py", line 5, in <module>
from . import resources
File "PROJECT_PATH\venv\lib\site-packages\ratcave\resources.py", line 40, in <module>
default_camera = Camera()
File "PROJECT_PATH\venv\lib\site-packages\ratcave\camera.py", line 260, in __init__
self.projection = PerspectiveProjection() if not projection else projection
File "PROJECT_PATH\venv\lib\site-packages\ratcave\utils\observers.py", line 56, in __setattr__
super(AutoRegisterObserver, self).__setattr__(key, value)
File "PROJECT_PATH\venv\lib\site-packages\ratcave\camera.py", line 299, in projection
self.reset_uniforms()
File "PROJECT_PATH\venv\lib\site-packages\ratcave\camera.py", line 302, in reset_uniforms
self.uniforms['projection_matrix'] = self.projection_matrix.view()
File "PROJECT_PATH\venv\lib\site-packages\ratcave\shader.py", line 139, in uniforms
self.update()
File "PROJECT_PATH\venv\lib\site-packages\ratcave\utils\observers.py", line 47, in update
self.on_change()
File "PROJECT_PATH\venv\lib\site-packages\ratcave\physical.py", line 186, in on_change
Physical.on_change(self)
File "PROJECT_PATH\venv\lib\site-packages\ratcave\physical.py", line 138, in on_change
self.model_matrix = np.dot(self.position.to_matrix(), self.rotation.to_matrix())
File "PROJECT_PATH\venv\lib\site-packages\ratcave\coordinates.py", line 126, in to_matrix
return self.to_radians().to_matrix()
File "PROJECT_PATH\venv\lib\site-packages\ratcave\coordinates.py", line 95, in to_matrix
mat[:3, :3] = R.from_euler(self.axes[1:],self._array,degrees=False).as_dcm() # scipy as_matrix() not available
AttributeError: 'scipy.spatial.transform._rotation.Rotation' object has no attribute 'as_dcm'. Did you mean: '_uniforms'?

这是我的代码:

import pyglet
import ratcave as rc


# Create Window
window = pyglet.window.Window()


pyglet.app.run()

最佳答案

好像方法名改成了from_matrix


scipy.spatial.Rotation方法from_dcm中,as_dcm被重命名为from_matrixas_matrix 分别。

引用: https://github.com/scipy/scipy/blob/5f4c4d802e5a56708d86909af6e5685cd95e6e66/doc/release/1.4.0-notes.rst


希望问题得到解决。

关于python - 鼠洞 : 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65628149/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com