#Collisions problem

17 messages · Page 1 of 1 (latest)

twin edge
#

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)

hard moat
#

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)

hard moat
twin edge
#

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?

twin edge
# hard moat

Ok so even if I put a collsion shape 2D I just walk on it

hard moat
#

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

twin edge
hard moat
twin edge
#

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...

▶ Play video
hard moat
#

Then could you show your tile collision shapes? (the thing the video talks about at around 2:38)

twin edge
#

I think it's that

hard moat
#

Maybe make the Player a child of world and not TileMap?

twin edge
#

I can still walk through

twin edge
#

it may come from my code for th emovements but i can't really be sure on that one