作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 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_matrix
,as_matrix
分别。
希望问题得到解决。
关于python - 鼠洞 : 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65628149/
我是一名优秀的程序员,十分优秀!