Godot does have collision functions. areas have: get_overlapping_bodies/areas, and overlaps_body/area. There's also the physics server, which lets you directly interact with the physics, including things like ray and shape casting, check collision with points and shapes, etc.
Thank you very much! Nice video! Looks like a good workaround for that issue, but let's hope that Godot comes with a quality-of-life-improvement here in the future :-)
I think is intended by design. Arrays and Dictionaries tend to be the solution for anything complex in Godot. That said, the CharacterBody node types do have built-in functions like is_on_floor/wall/ceiling, so a special Area-like node type with built in constant monitoring and array could happen.
i solved this by issue attaching an area (of the same size of the main collider) to the player. each time there's an entered or exited signal i make the player check for overlaps and do all kinds of computations between the player's area and the scene's area or enemy attacks. and you can even simulate a layering situation (items placing, an area of interest, whatever) by attaching an order value to the scene's area, and make the player only react to the area with the higher number for example. it doesn't use any _process function so it's pretty fast and scalable
That’s a nice solution that I wouldn’t have thought of. I’m not used to working in 3D, but the way I’ve solved this in 2D is to use a raycast right where the player is standing. Then the raycast can check what kind of collider it’s colliding with (if any), and the player can act appropriately. The raycast can only detect one collider at a time, but this can be solved: Detect the first one, then add it to the exclude list, and check the raycast again for the next collider. But if the two colliders are supposed to affect the player in the same way, this won’t be nevessary.
Actually I think the most complete version of this solution would definitely include raycasting. How else are you going to know if an object is behind a wall? I just left it out to simplify things.
Subscribed! Your explanations are clear, but the voice channel was a bit muddy D: - In future videos is there some sort of post-processing you could run to punch up the clarity? Ty :)!
Why is the dictionary inside the player script and not each area script? Not that I've given it much thought on how to implement it, but fundamentally it feels like the area should be responsible for tracking the bodies inside of it and applying its effects.
In this case is on the player in an attempt to make it easier to understand. I thought is more intuitive if people think of it as "Player enters and exits Areas, and is able keep track of them using a Dictionary". The Player also has an area as child which is the one detecting other areas, btw. But it just sends a signal to the Player node which is the one running the code (has the script). The dictionary can be on the Area node, of course, if the area is the one that is running the code or just if you want an area keeping track of other areas. It depends on what you want and what you need.
Next time, us a better AI for voice. Or is that actually how you sound? I had to turn on the subtitles to understand you. Sounds like you're talking through a pillow with the same tone at the end of your sentences; thus why I think it's AI voiced.
Godot does have collision functions.
areas have: get_overlapping_bodies/areas, and overlaps_body/area.
There's also the physics server, which lets you directly interact with the physics, including things like ray and shape casting, check collision with points and shapes, etc.
Awesomely explained, thanks.
Happy to know that, given that i skimmed over so many things.😆
Thank you very much! Nice video! Looks like a good workaround for that issue, but let's hope that Godot comes with a quality-of-life-improvement here in the future :-)
I think is intended by design. Arrays and Dictionaries tend to be the solution for anything complex in Godot. That said, the CharacterBody node types do have built-in functions like is_on_floor/wall/ceiling, so a special Area-like node type with built in constant monitoring and array could happen.
i solved this by issue attaching an area (of the same size of the main collider) to the player. each time there's an entered or exited signal i make the player check for overlaps and do all kinds of computations between the player's area and the scene's area or enemy attacks.
and you can even simulate a layering situation (items placing, an area of interest, whatever) by attaching an order value to the scene's area, and make the player only react to the area with the higher number for example.
it doesn't use any _process function so it's pretty fast and scalable
Nice priority system. Thanks for sharing, as there is no doubt people that will have to deal with this kind of problem.
That’s a nice solution that I wouldn’t have thought of.
I’m not used to working in 3D, but the way I’ve solved this in 2D is to use a raycast right where the player is standing. Then the raycast can check what kind of collider it’s colliding with (if any), and the player can act appropriately. The raycast can only detect one collider at a time, but this can be solved: Detect the first one, then add it to the exclude list, and check the raycast again for the next collider. But if the two colliders are supposed to affect the player in the same way, this won’t be nevessary.
Actually I think the most complete version of this solution would definitely include raycasting. How else are you going to know if an object is behind a wall? I just left it out to simplify things.
Subscribed! Your explanations are clear, but the voice channel was a bit muddy D: - In future videos is there some sort of post-processing you could run to punch up the clarity? Ty :)!
You wouldn't believe the sound is still a big improvement from my early videos. lol. But Ill do my best. thx for the feedback.
Why is the dictionary inside the player script and not each area script? Not that I've given it much thought on how to implement it, but fundamentally it feels like the area should be responsible for tracking the bodies inside of it and applying its effects.
In this case is on the player in an attempt to make it easier to understand. I thought is more intuitive if people think of it as "Player enters and exits Areas, and is able keep track of them using a Dictionary". The Player also has an area as child which is the one detecting other areas, btw. But it just sends a signal to the Player node which is the one running the code (has the script).
The dictionary can be on the Area node, of course, if the area is the one that is running the code or just if you want an area keeping track of other areas. It depends on what you want and what you need.
Next time, us a better AI for voice. Or is that actually how you sound? I had to turn on the subtitles to understand you. Sounds like you're talking through a pillow with the same tone at the end of your sentences; thus why I think it's AI voiced.
check your ears with a doctor.