godot-python
godot-python copied to clipboard
3D rotation does not work (rotate_x, rotate_y, rotate_z, etc.)
When I do the following in GDScript:
extends Spatial
func _process(delta):
rotate_y(PI*delta)
print(transform)
then the objects rotates as intended and the output is also as expected:
0.902019, 0, 0.431697, 0, 1, 0, -0.431697, 0, 0.902019 - 0, 0, 0
0.657948, 0, 0.753064, 0, 1, 0, -0.753064, 0, 0.657948 - 0, 0, 0
0.629321, 0, 0.777146, 0, 1, 0, -0.777146, 0, 0.629321 - 0, 0, 0
...
But when I do the same in python:
from godot import exposed, export
from godot.bindings import Spatial
from math import pi
@exposed
class CamPivot(Spatial):
def _process(self, delta):
self.rotate_y(pi*delta)
print(self.transform)
The objects stays as it is and the output also shows this:
<Transform(1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0)>
<Transform(1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0)>
<Transform(1, 0, 0, 0, 1, 0, 0, 0, 1 - 0, 0, 0)>
...
pi*delta yields the correct result in python, I tested that. The method is also found, if you change it to something else you get errors. Methods I so far didn't get to work: rotate_[x|y|z](), rotate(). This is all 3D btw.
I used Godot 3.1.1stable, godot-python 0.11.3 with CPython. Ubuntu.
Maybe fixed by #122, but it's not released yet. You can build current master branch:)