I have two positions, my cameras, and one from an object. I want to be able to move the camera smoothly from on position to the other. Since the positions are always different, animation players don't work(as far as I know).

all 11 comments

sorted by: hot top controversial new old
[–] 6 points 3 years ago (1 child)

Use a Tween. If it's only translation it's very straightforward. If rotation comes into play, you will probably have to use quaternions instead of Euler angles. More info here.

  • source
  • hideshow 2 child comments
  • [–] [S] 1 point 3 years ago (1 child)

    Are these 2D/Script only, because I can't find them when pressing plus to add a new node?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 3 years ago (1 child)

    In Godot 4 they're no longer a node. Check the updated docs for how to use them, they work fine in 3D and you can tween any value.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 1 point 3 years ago (2 children)

    Thanks, was looking at old threads, do you know how I can rotate with tweens, "position" is for movement, but I can't find something as rotate, does it exist?

  • source
  • parent
  • hideshow 4 child comments
  • [–] 2 points 3 years ago (1 child)

    You can tween pretty much any property(color, scale, position, rotation, modulate, etc) check out the arguments in the tween function.

    Here is the doc page for tweens: https://docs.godotengine.org/en/stable/classes/class_tween.html#class-tween

    You can see you make a tween using

    var tween = get_tree().create_tween()

    Then you call tween_property. The arguments are: node to tween(your camera), property to tween(the rotation), desired end state(rotation at the end), time in seconds.

    tween.tween_property($Sprite, "modulate", Color.RED, 1)

    There are all kinds of fancy tweeners you can add on for making things run one after the other instead of in parallel, having smoother transitions. It's all in the docs and then fiddling.

    Good luck!

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 1 point 3 years ago (1 child)

    rotation_degrees

    I just can't find rotation in the docs

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 3 years ago

    That is the fiddeling around part. I've never dealt with 3D or rotations on a tween, but I know it can be done. Do not expect the docs to have EXACTLY what you want. It is a guide with some examples but at some point you have to make the jump and into something unknown and try.

    That is honestly 90% of programming. I know what I want, I have some examples if something similar...how do I make it work in my situation.

    Give it a try and report back with your success or issues.

  • source
  • parent
  • [–] 4 points 3 years ago
    [–] 1 point 3 years ago (1 child)