use transform method rotated()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lalel345

why this doesn’t work?

if event is InputEventMouseMotion:
  transform.rotated(Vector3(1.0, 0.0, 0.0), deg2rad(event.relative.y * 0.1))
:bust_in_silhouette: Reply From: Bean_of_all_Beans

So the method rotated for Transform returns a new Transform with the appropriate rotation. To make use of that returned value, you would want to put the following into your code:

transform = transform.rotated(Vector3(1.0, 0.0, 0.0), deg2rad(event.relative.y * 0.1))