Godot Tip 「Tile Collision With Tilemap and a Physics Body」
Posted by SysL, on January 24, 2025. [Link]
This is how you can detect what tiles you are colliding with when using a Physics Body.
extends Node2D
@export var area: Area2D
@export var map: TileMap
func _ready():
area.body_shape_entered.connect(area_entered)
func area_entered(_body_rid: RID, _body: Node2D, _body_shape_index: int, _local_shape_index: int):
map.erase_cell(0,map.get_coords_for_body_rid(_body_rid))
Information from BipBop (Godot Engine Forms, December 13 , 2023)
Godot Weird Problem:Viewport Texture Error with Model
Posted by SysL, on January 23, 2025. [Link]
In Godot, if you set a ViewPort Texture directly on a Material Albedo you will receive a warning when running your game from the editor. This error appears to be harmless in game but it is annoying.
To work around it, you can set it in code:
- Grab a reference to the mesh
- Grab a reference to the viewport/subviewport
- In the _ready() callback, set the texture.
@onready var mesh_instance_3d: MeshInstance3D = $MeshInstance3D
@onready var sub_viewport: SubViewport = $SubViewport
func _ready() -> void:
mesh_instance_3d.get_surface_override_material(0).albedo_texture = sub_viewport.get_texture()
This is not likely to be fixed anytime soon, it's been open since 2022...
Information from MamaDespik (Reddit, April 29, 2024)
Godot Tip 「Game-Isometric Camera」
Posted by SysL, on January 23, 2025. [Link]
Using Node: Camera3D
- Projection: Orthogonal
- Rotation: -30, 45, 0 (XYZ)
- Size: 8M-10M (Based on Pixel Size)
- Far: 200M (Fixes issues with Orthogonal Shadows) [Calinou, Godot Issue 58332, Feb 19, 2022]
Quick Code Note for Camera (You may have to rotate input):
var direction := (Vector3(input_dir.x, 0, input_dir.y)).rotated(Vector3.UP, main_camera.rotation.y).normalized()
Godot Weird Problem:Audio Bus Names Not Working
Posted by SysL, on January 23, 2025. [Link]
I've had this issue where the Audio Busses defined would not load on project start up OR they would load but the names would not work. To fix it, I had to do the following:
- Save out your Bus Configuration
- Open the General Settings
- Open Audio -> Buses
- Set the Default Bus Layout