I have been following the make your own game in 3D tutorial in getting started section of godot's docs, I did everything as it's written in the website, however, the collisions are not working
the section of the tutorial https://docs.godotengine.org/en/stable/getting_started/first_3d_game/06.jump_and_squash.html
I tried to print the collider whenever there is a collision, it does print the ground, however, whenever a collision happens with enemies, nothing is printed, here is the code
extends CharacterBody3D
# How fast the player moves in meters per second.
@export var speed = 14
# The downward acceleration when in the air, in meters per second squared.
@export var fall_acceleration = 75
# Vertical impulse applied to the character upon jumping in meters per second.
@export var jump_impulse = 20
# Vertical impulse applied to the character upon bouncing over a mob in
# meters per second.
@export var bounce_impulse = 16
var target_velocity = Vector3.ZERO
func _physics_process(delta):
#...
# Going through all the colliders
for index in range(get_slide_collision_count()):
# We get one of the collisions with the player
var collision = get_slide_collision(index)
# If the collision is with ground
if collision.get_collider() == null:
continue
# If the collider is with a mob
if collision.get_collider().is_in_group("mob"):
print(collision.get_collider())
var mob = collision.get_collider()
mob.squash()
break
move_and_slide()
extends CharacterBody3D
# Minimum speed of the mob in meters per second.
@export var min_speed = 10
# Maximum speed of the mob in meters per second.
@export var max_speed = 18
signal squashed
func squash():
squashed.emit()
queue_free()
collision layers and masks are correctly set, and I made a group as well for mobs, like shown in the screenshot
In this part, we'll add the ability to jump and squash the monsters. In the next lesson, we'll make the player die when a monster hits them on the ground. First, we have to change a few settings re...