Hello, so I'm starting godot and i want to make collisions with the trees which are on a specific layer but I don't know why the collision does nothing.
I was watching a tuto on y sorting and collision the y sorting works well but I just don't have any collisions. So if someone has an idea that would be nice.
My supposition is that it comes from the collision of the player but I'm not sure.
(You can't see it very well but I do have a collision shape on the player but it's behind it)
#Collisions problem
17 messages · Page 1 of 1 (latest)
StaticBody2Ds only interact with cerain Layers, more specifically each StaticBody2D has its own Layer and Mask it can interact with
EDIT: Not ColissionShape2D but Area2D, sorry!
EDIT 2: StaticBody2D instead of Area2D...
For example, you can make all environment objects be on Layer 2
Then set the player to be Layer 1, but Mask 2
This way the player will be able to interact with the environment, because the player "sees" them (detects the mask)
if I understood correctly this is what you did but it doesn't change anything can it be because my objects are on my layer and not on a collision shape 2D?
Show your Tilemap tree, does it have StaticBody2Ds on each tree?
A tilemap is just a bunch of textures, you should make a map and then add StaticBody2Ds on each thing you want to be able to collide with
ok but is it possible to make it so I don't have to put a hitbox on each tree i put on the map?
Here what I did was to go in the tileset in tilemap I activated Physics Layer and then I put a physics layer 0 (not sure of the name I'm not english sry) on my trees wich then have a hit box but i'm not sure they have a static body 2d
You can make a little Tree scene with a sprite and a staticBody, and then put those trees anywhere you please.
https://www.youtube.com/watch?v=C0N8VgPYK8I&list=PLMQtM2GgbPEVuTgD4Ln17ombTg6EahSLr&index=8
I used this tutoorial if I don't explain myself well
Hi and welcome to this tutorial series, where I will show you how to make a 2D ARPG in Godot 4.
Support the channel on Patreon: https://patreon.com/MakerTech
Support the channel with a Youtube membership: https://www.youtube.com/channel/UCZfXxUfpS7q-v1gsMY-hQtA/join
Join the Discord server: https://discord.gg/7zKMaZDycE
https://youtube.com/play...
Then could you show your tile collision shapes? (the thing the video talks about at around 2:38)
Maybe make the Player a child of world and not TileMap?
I can still walk through
it may come from my code for th emovements but i can't really be sure on that one