/r/godot

Photograph via snooOG

The official subreddit for the Godot Engine.

Meet your fellow game developers as well as engine contributors, stay up to date on Godot news, and share your projects and resources with each other.

Maintained by the Godot Foundation, the non-profit taking good care of the Godot project - consider donating to https://fund.godotengine.org/ to keep us going!

Looking for Godot?

Download the engine, Donate to the fund, Follow us on socials & more! Official Link-Collection

Apply to become a mod!


Subreddit rules:

1. English only, please

For moderation purposes, please stick to the official language of this subreddit, both for posts and comments.

You may link to sites in different languages, if you add a clear explanation what the content is about.

2. Code of Conduct

Read it here
Breaching the code is a ban-able offence. In particular, we won't tolerate discrimination or bullying of any kind.

3. Use appropriate flairs for your posts

If you don't, we maintain the right to delete the post in violation of this rule. Flair descriptions: https://www.reddit.com/r/godot/wiki/index/flairs/

4. Help rules

Repeated neglect can result in a ban.
1. Consult the documentation first
2. Search for your question before posting
3. Concrete questions/issues only! Don't ask "How to make X" before doing research
4. "Can Godot be used to make this game?" Yes.
5. Don't post photos of your screen, screenshots are okay, direct code with formatting or a pastebin is best
6. We recommend checking the official forum for solutions as well. Make sure to link between the platforms when you cross-post questions.

5. Promotion rules

You are required to use the promotion flair whenever you want to showcase your game. Do NOT use the "discussion" flair. You may use "fun & memes" when applicable, but do so sparingly and tailor your post to match the category.

6. Discussion rules

This flair is for constructive conversations, not for venting your frustrations. Should you have feedback for the engine development team directly, please open an issue or proposal on GitHub instead. Email the Code of Conduct team at conduct@godotengine.org for any "people problems" you might have. For reddit-specific problems, please use the ModMail or report functions. Do NOT use this flair to showcase your game, see the rule above.

7. Post memes with consideration

They must have the "fun & memes" flair, be related to Game Development, and the topic/content cannot breach the Code of Conduct. Do not spam memes.

8. Stay on topic

This is a subreddit about the Godot Engine. While related Game Development topics are not forbidden, please make sure to tailor them towards the Godot project. This means NO ART posts unless you are talking about the technical side of things - there are enough other outlets to post your pretty renders and concepts.

9. Getting started

Reference this https://docs.godotengine.org/en/stable/getting_started/introduction/index.html before asking for general advice/help. Posts asking "Where do I start?" will automatically be locked, due to this subreddit overflowing with them in the past

10. Copyright & AI-generated content

For legal reasons, you may only post content that you are the rights-holder of. This means you are required to credit assets according to the licenses you acquired them under. Some licenses permit sharing content without listing your sources, others do not. In particular, this means that AI-generated content needs to verifiable stem from a model which was trained only on data submitted with the original creator's consent. If you cannot prove this to be the case upon request, we remove your post.

/r/godot

237,311 Subscribers

1

Base Control node not sizing and positioning properly under a container

This appears to be 100 % reproducible, and I'm not sure why it happens or how to fix it:

  1. Create a new container node (VBox, HBox, or Grid).
  2. Add Control children for it.
  3. Add any other controls inside those, in my example I'm adding a Button (in an AspectRatioContainer, breaks either way).

This is how it works if I add the buttons directly into the container node, just like you'd expect: https://i.imgur.com/fn294DZ.png

And this is how everything breaks if I add a Control middleman between the button and the container: https://i.imgur.com/I8k7MuD.png

As you can see, all the buttons are shifted up so that the topmost goes out of the screen completely and the bottom most is not inside the bottom control that I have selected.

I've already tried messing with the Fill and Expand settings of each node to no success.

The reasons I want to use base Control node in the first place is because I want to hide the "implementation detail" of it being a Button (or an AspectRatioContainer) specifically, as this part could (and probably will) change in the future when my game grows. Some ways this shows itself is:

  1. in the inspector where I don't want to see and even rely on the button's properties, only my custom exported ones, and
  2. in the scene tree where I want to name my root node properly so that other scenes show Tile in their scene tree when they create a new instance of it, without hiding any of the details of its implementation.

Furthermore, I highly believe this should be not only possible but trivial thing to do, regardless of my specfic reasonings.

Am I missing something and it's actually trivial?
Or am I missing a design principle of Godot engine's and trying to do something I shouldn't be?
Or is there just a bug here?

0 Comments
2025/02/02
06:51 UTC

10

testing out world space/canvas space UI

0 Comments
2025/02/02
06:13 UTC

2

My Gravity has stopped working

8 Comments
2025/02/02
06:07 UTC

20

I just finished a two week jam, and I can't stop playing my game! Pride posting.

Thanks to the Godot devs for this engine. I've been doing amateur game dev for a while but this is the first time I've felt really good about the thing I've made, and loving the tools I use to build it has truly been a huge part of that.

4 Comments
2025/02/02
05:42 UTC

6

Why does my car fly after touching the ground?

5 Comments
2025/02/02
04:58 UTC

5

I made a tutorial to fix flying off/jumping off a slope when going down it...

Here's my video:

https://www.youtube.com/watch?v=g88sXsq8Z-U

I had a LOT of trouble getting an answer, but at last, I found the answer, and it fixed it. Hope everyone, if your a beginner or not. I hope you find this useful!

0 Comments
2025/02/02
04:34 UTC

2

Why does the character in my game not detect enemies when walking away from them

3 Comments
2025/02/02
04:07 UTC

0

I need help

I'm new to Godot and I'm about to give up on my Godot project, since I don't know how to do it, and no one has been able to explain it to me or I don't know if it's really possible. I want to share an animation with several objects. I have a piano and I want to put animations on that piano when pressing the keys, but I don't want to make an animation for each key, but rather make it so that the animation for key 1 can be reused on key 2. But I don't know what else to do. Does anyone know how to do it? Please explain it to me or give me a tutorial, or the code.

7 Comments
2025/02/02
03:28 UTC

3

Making Area2D continuously check collision

Godot Version 4.3

How can I make my character take damage continuously if enemy body entered and never exited HurtBox? I’ve struggled and looked at a number (like might be 6hrs of research). I’ve only started learning coding and godot last week.

Here’s my PLAYER script:

extends CharacterBody2D

signal player_hit

u/export var max_health: float = 100.0
u/export var speed: int = 1000
var current_health = max_health

func _physics_process(_delta: float) → void:
var direction = Input.get_vector(“left”,“right”,“up”,“down”)
velocity = direction * speed
move_and_slide()

func _on_hurt_box_area_entered(area: Area2D) → void:
print(“Player hurt”)
if area.get_parent().has_method(“get_damage_amount”):
var node = area.get_parent() as Node
current_health -= node.damage_amount
print("Player Health amount: ", current_health)

and ENEMY script:

extends CharacterBody2D

u/export var max_health: float = 5.0
var speed: int = 100
var current_health = max_health
u/export var damage_amount = 1.0
u/onready var player = get_node(“/root/Level/Player”)

func _ready() → void:
current_health = max_health

func _physics_process(_delta: float) → void:
var direction = global_position.direction_to(player.global_position)
velocity = direction * speed
move_and_slide()

func _on_hurt_box_area_entered(area: Area2D) → void:
pass
#print(“Enemy Hurtbox area entered”)
#if area.get_parent().has_method(“get_damage_amount”):
#var node = area.get_parent() as Node
#current_health -= node.damage_amount
#print("Health amount: ", current_health)

func _on_hit_box_area_entered(area: Area2D) → void:
print(“Enemy area entered”)

func _on_hit_box_body_entered(body: Node2D) → void:
print(“Enemy body entered”)

func get_damage_amount() → int:
return damage_amount

The enemy only damages the player once when its body hitbox the hurtbox. I have the hitbox and hurtboxes in the player and enemy bodies. Thanks in advance!

PS - I also have this issue where when the enemy body collides with the player, it sticks to the player body and never lets go lol. its a mess

7 Comments
2025/02/02
03:19 UTC

1

Godot Control Tutorial - This video finally helped me make control nodes click

0 Comments
2025/02/02
02:31 UTC

1

Looking for code examples online

Hello community, I've been working on my 2D side scroller, player controller for about a month now, building it from scratch with what I learnt from Brackeys tutorial and my limited knowledge on godots many features. It's going really good and I'm learning alot and making lots of mistakes which is good!

Does anyone have any recommendations for a good resource of player controller code examples. Looking for basic kind of concepts to see how other people handle basic attacks and movements like rolls and jumps etc that I can hopefully learn from and maybe even recreate.

1 Comment
2025/02/02
02:11 UTC

1

Articles on GDScript

Are there any articles (academic preferable since I'm doing a technical project) on the history of GDScript or studies on its capabilities, inner workings, etc.

1 Comment
2025/02/02
02:04 UTC

1

Do MipMaps work for 2D?

If I use mipmaps on high resolution sprites and zoom out with my 2D camera, do they still work the same as in 3D? Also, do they work with tilemaps?

0 Comments
2025/02/02
01:33 UTC

1

Altering code by accident when I run the project (more info in comments)

13 Comments
2025/02/02
01:28 UTC

2

Quick question

How do I use functions from other scripts in a seperate script?

4 Comments
2025/02/02
01:19 UTC

1

help please

Invalid access to property or key 'transform' on a base object of type 'null instance'.

var gravity = 9.8

u/onready var head = $Head

u/onready var camera = $Head/Camera3D

func _ready():

Input.set\_mouse\_mode(Input.MOUSE\_MODE\_CAPTURED)

func _unhandled_input(event):

if event is InputEventMouseMotion:

	head.rotate\_y(-event.relative.x \* SENSITIVITY)

	camera.rotate\_x(-event.relative.y \* SENSITIVITY)

	camera.rotation.x = clamp(camera.rotation.x, deg\_to\_rad(-40), deg\_to\_rad(60))

func _physics_process(delta):

\# Add the gravity.

if not is\_on\_floor():

	velocity.y -= gravity \* delta



\# Handle Jump.

if Input.is\_action\_just\_pressed("jump") and is\_on\_floor():

	velocity.y = JUMP\_VELOCITY



\# Handle Sprint.

if Input.is\_action\_pressed("sprint"):

	speed = SPRINT\_SPEED

else:

	speed = WALK\_SPEED



\# Get the input direction and handle the movement/deceleration.

var input\_dir = Input.get\_vector("left", "right", "up", "down")

var direction = (head.transform.basis \* transform.basis \* Vector3(input\_dir.x, 0, input\_dir.y)).normalized()

if is\_on\_floor():

	if direction:

		velocity.x = direction.x \* speed

		velocity.z = direction.z \* speed

	else:

		velocity.x = lerp(velocity.x, direction.x \* speed, delta \* 7.0)

		velocity.z = lerp(velocity.z, direction.z \* speed, delta \* 7.0)

else:

	velocity.x = lerp(velocity.x, direction.x \* speed, delta \* 3.0)

	velocity.z = lerp(velocity.z, direction.z \* speed, delta \* 3.0)



\# Head bob

t\_bob += delta \* velocity.length() \* float(is\_on\_floor())

camera.transform.origin = \_headbob(t\_bob)



\# FOV

var velocity\_clamped = clamp(velocity.length(), 0.5, SPRINT\_SPEED \* 2)

var target\_fov = BASE\_FOV + FOV\_CHANGE \* velocity\_clamped

camera.fov = lerp(camera.fov, target\_fov, delta \* 8.0)



move\_and\_slide()

func _headbob(time) -> Vector3:

var pos = [Vector3.ZERO](http://Vector3.ZERO)

pos.y = sin(time \* BOB\_FREQ) \* BOB\_AMP

pos.x = cos(time \* BOB\_FREQ / 2) \* BOB\_AMP

return pos
1 Comment
2025/02/02
01:01 UTC

1

New to Godot and I have a question

I have a label in front of a button. How can I make it so the mouse clicks on the button through the label, or put the button in front of the label but have it invisible and still active

3 Comments
2025/02/02
00:49 UTC

24

Balatro Text Gif Maker - Movie Maker Mode + ffmpeg

1 Comment
2025/02/02
00:41 UTC

1

Godot Click and Grab with Swing Physics

https://preview.redd.it/guwskcpdcmge1.png?width=682&format=png&auto=webp&s=b691a98e660bf9883d180e1d889e660864bfb212

Hi all, I'm trying to implement that when I pick up an object it swings like a pendulum with the mouse's movement. There's a diagram attached (really shitty one, sorry) to try and demonstrate what I'm trying to achieve. I've successfully implemented the click and grab with the sprite animations I want, I just am having trouble with the physics side of things. I've been toying around with a characterbody2d and a rigidbody 2d but am unsure on which would be better/easier to implement this on.
I essentially want to, in the physics process, set the rotation of the object (the rotation pivot is at the mouse cursor already) I'm just not exactly sure how to go about this to get my desired effect. I've also attached a video of what the project looks like right now with broken physics to help visualize.

https://reddit.com/link/1ifkkxu/video/z8ua8ba1dmge1/player

2 Comments
2025/02/02
00:20 UTC

1

CharacterBody3D flying off of slope when going down.

3 Comments
2025/02/02
00:14 UTC

1

Weird Lines in 2d

5 Comments
2025/02/02
00:05 UTC

9

"DOOM, but Algebra" - Super MAGFest 2025

Debuted of our game, EOPRISM, at Super MAGFest this past week. We're a few months into development and is available to wishlist on Steam now!

1 Comment
2025/02/01
23:51 UTC

75

I've got 9 months of experience in Godot - here's my game so far!

3 Comments
2025/02/01
23:42 UTC

1

Guide for 3d lighting for Quake like retro fps?

Hi.

Does anyone know of a good guide, or has any information, about how lighting from retro fps like Quake (or more recent ones like Dusk) can be done in Godot? Is it only Omnidirectional lights, or is it a mix of Omni lights and some other light sources (ambient, emission, global illumination, etc.) ?

I am not looking for a exact recreation, just an idea of the basic light mix that I could use in Godot to recreate something similar.

1 Comment
2025/02/01
23:41 UTC

1

Issues creating a scalable interaction system

So I've been trying to make a scalable interaction system for a few weeks now and I keep running into problems. I can't find anything consistent on the internet either. I'm new to programming, and very new to Godot, so bear with me if this is something super simple.

I want to have a first person character interact with 3d objects using a raycast. There would be multiple different types of interactable objects that do different things (Item you can pick up, Door you can open, Trunk you can 'dump' Items into).

My first iteration of an interaction system went like this:

  • I made the class 'Interactable'. It basically just exists and has a can_interact? bool.
    • I have an Item class, which extends from Interactable.
      • Item has price and weight variables.
    • I have a Door class, which extends from Interactable.
      • Door has a bool for is_open

And for the main interaction script:

  • I have a first person player with a raycast parented to their camera.
    • If the raycast is colliding with an object, check if the collider is of class Interactable.
    • If it is Interactable, show a prompt and change the crosshair.
    • Next, check if its of class Item.
      • If it is Item and the player presses E, handle everything related to picking up an item.
    • Else, check if it's of class Door.
      • If it is Door and the player presses E, handle everything related to opening a door.

This worked great for a while. I knew having a bunch of if statements wasn't the best way to do it, but it worked. Up until this point how the game played was you'd pick up Items, and then go dump them into a car's Trunk. The Trunk was just an Area3D you would walk into.

Problems started occurring when I wanted to make the Trunk interaction the same as the Item and Door interaction (Aim crosshair on the Trunk and press E to interact with it to deposit items, as opposed to walking into an Area3D).

Things started to get messy and I knew having a bunch of if statements isn't good. So, I've been trying to figure out a better method. And I cannot find anything, or get any help. (Which is why this post is so extensive)

I thought about using has_method(""). This seemed okay, but what if the collider doesn't have the method? Then there's no error and you have no clue why it's not working. Plus, if you ever change the name of the method it will break, etc etc. Did not seem right.

I thought about using groups, but that didn't seem right either. Make an Item group, a Door group, a Trunk group, and check if the object is in group item/door/trunk...... anddd I'm basically just checking a bunch of if statements again.

Okay, so what about using nodes and have a component-like approach like how Godot intends? Sounds fantastic. So, for Items you can pick up, just attach a Pickupable node to them. This node can hold the script that handles what happens when you pick up an item as well, even better. And Doors can get an Openable node.. right? Sounds good so far, but do you just loop through each child of the raycast collider every time to check what component the collider has? That doesn't sound right.

And how do you check if the object you're colliding with even is interactable in the first place? What if it's colliding with the floor or a wall, are you looping through the children of every object you collide with??

At this point my brain is fried, I feel very stupid, and I'm sure I'm overlooking some things that are probably pretty simple. I need the system to be pretty broad, because I'll have a bunch of different Items that will all have different models and textures, different prices and weights, but all basically have the same function for picking them up (queue free them, play some particles, add the price to what's being carried, etc etc). Same thing for Doors.

4 Comments
2025/02/01
23:40 UTC

1

help! does anyone know what causes this weird visual artifacting?

When I move around with my player controller or even in editor my models will rapidly jitter at the seams of the model. Has anyone encountered this before? I am pretty new to the engine if you can't tell by the crapper minecraft placeholders lol.

https://preview.redd.it/5fygejx94mge1.png?width=1322&format=png&auto=webp&s=44b156aeaded7d744f43627d6a34c2138b55167c

1 Comment
2025/02/01
23:33 UTC

3

How should I go about making underwater graphics?

I'm making a game that takes place underwater, I've already got a little shader set up that affects the camera when you're underwater, changing the tint, blurring a little, and creating some warping effect. However, my game takes place deep underwater, where I don't want you to be able to see too much around you and for the surrounding area to be dark unless there are nearby lights. Is there anyway to do this? Should I just make a depth blend in my shader and not worry about the specifics?

This is my first time doing something like this, and I don't entirely know what to do or how to even search for what I'm trying to do. Any tips? This is the current shader I'm using for the underwater camera.

https://preview.redd.it/yqey6ulo2mge1.png?width=910&format=png&auto=webp&s=b05b619d2f23f90a3e5f0d686274eb1ce4178808

1 Comment
2025/02/01
23:22 UTC

1

No TileMap button at the bottom (Godot 4.3)

Hello! As the title says. I am a complete beginner following a tutorial by Rapid Vectors. At 9:51 he clicks on the "TileMap" button at the bottom. But I do not see it on my own screen. Am I doing something wrong? Or is this due to version differences?

https://preview.redd.it/jp2rngwaxlge1.png?width=702&format=png&auto=webp&s=ffd2283de8f13fc46b8021f9411e2c03e419535a

my screen

3 Comments
2025/02/01
22:57 UTC

Back To Top