this post was submitted on 21 Jul 2023
13 points (100.0% liked)
Godot
5909 readers
11 users here now
Welcome to the programming.dev Godot community!
This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.
Make sure to follow the Godot CoC while chatting
We have a matrix room that can be used for chatting with other members of the community here
Links
Other Communities
- !inat@programming.dev
- !play_my_game@programming.dev
- !destroy_my_game@programming.dev
- !voxel_dev@programming.dev
- !roguelikedev@programming.dev
- !game_design@programming.dev
- !gamedev@programming.dev
Rules
- Posts need to be in english
- Posts with explicit content must be tagged with nsfw
- We do not condone harassment inside the community as well as trolling or equivalent behaviour
- Do not post illegal materials or post things encouraging actions such as pirating games
We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent
Wormhole
Credits
- The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
- The banner is from Godot Design
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
Are these 2D/Script only, because I can't find them when pressing plus to add a new node?
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.
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?
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!
I just can't find rotation in the docs
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.
Yes, you can tween the "rotation" or "rotation_degrees" property. If you need to tween a specific axis you can tween "rotation_degrees:x" for example.