How do I set the rotation of the an object directly?

I’m new to Godot and I dont exaclty full understand like this whole basis thing like I want to just pass in angles directly and have the be those angles if that makes sense, like how I’m doing for the location in ObjectAnimation class



func _process(delta: float):
   if self.paused:

   self.frameTime += (delta * self.FPS)
   self.frameTime = clamp(self.frameTime, 1, len(self.animationData))

   var frame = self.animationData[str(ceil(self.frameTime))]

   if frame and ceil(self.frameTime) < len(self.animationData):
      var location = frame["location"]
      var rotation = frame["rotation"]

      object.transform.origin = Vector3(location[0], location[1], location[2])
      # apply rotation to object?
      print("Animation finished!")
      self.paused = true

Alright I figured it out, you just have to get the rotation of the object directly and use a Vector3 with angles that are converted to radians if not already!


object.rotation = Vector3(x,y,z)

I think there’s also .rotation_degrees as well.

1 Like

Deg_to_rad() is useful for changing rotations as well.

Rotation += deg_to_rad(90) should turn object 90 degrees, with negative values turning the opposite direction.