New Recruit Needing Help! (Godot 4)

Hi, All.

New recruit here with GameDev.tv and looking to tap into your Godot knowledge. I am following along with the Complete Godot 3D: Develop Your Own 3D Games Using Godot 4 course, but have come across an issue I can’t seem to get my head around, even after rewatching the lesson.

I am currently on the Collision Detection lesson and have, as far as I am aware, followed all the steps, but it doesn’t seem to be working :pensive:. Also, I am new to the Godot engine so my terminology may not be on point just yet.

I have went to the player object and created a signal for the Rigid3dBody

I have also enabled the Contact Manager for the player object

I have add the target object (Landing Pad) to a group

I have added the exact code shown in the lesson

I should also point out that I am comfortable with programming as I have extensive experience with JS and Python so I assume that I am over-looking something else :persevere:

Hope you can follow the above and point me in the right direction :crossed_fingers:.

TIA

Stevie

Great! In general you should have an easy time learning the coding part then.

The first thing I’d check is whether or not the callback is actually being called. Easiest way to do that is to throw a print statement above the if-statement. The callback itself should be ok since the green icon beside line 15 indicates that this function has been wired up in the inspector, as you’ve indicated in your screenshots. It’s always worth checking though, as I have actually run into the occasional problem with that (probably just my own growing pains from learning the engine though).

The more likely reason for the callback not firing (given that your player contact monitor is set up and you’ve set up your group) is that CSGShapes also need to opt in to collision detection for performance reasons - a very easy thing to miss, especially after you’ve just duplicated a bunch of obstacles that already have it ticked. I’m sure you know, this is in the shape’s inspector at CSGShape3D–>Use Collision.

Hopefully that’s the reason; if not, post an update and we’ll go from there =)

The callback is definitely being called as I did test it with a print statement early on. I will return to it tomorrow and check the collision detection as suggested and hopefully that fixes it :crossed_fingers:

Thank you for the response. I will keep you posted :slightly_smiling_face:

1 Like

Ah, yes, this makes sense - I realized afterwards that collision opt-in status shouldn’t affect that callback, because that’s one way to make trigger “regions.” The problem is, for the same reason, collision can’t explain why your conditional is returning false.

After getting about halfway through making a minimum reproduction project, it dawned on me that there’s one other test you should do. The body being returned might not be what you expect - wouldn’t be the first time that happened to me. If you write print(body), your output should read something along the lines of LandingPad<[lots-a-numbers]>.

Because Bram saves the Landing Pad as a scene only after he makes it, it would also be a good idea to check that the Landing Pad in your level isn’t a rogue instance with its own overwritten properties - you’ll notice later that Bram himself runs into that issue, although I don’t remember where. Easily fixed just by deleting the instance and adding a new one into the level scene. If the Landing Pad was added to the Target group after being saved as a scene, there’s a chance this could be the problem (since I don’t know exactly what entity you took the Group screenshot from).

I couldn’t resolve the issue so started a new project. When I got back to the same point, everything worked fine. I must have overlooked something but not sure what :confused:.

Thank you for the suggestions. I’m sure that they will come in handy at some point along my journey :slightly_smiling_face:

1 Like

Hm. Well, as long as it works! Enjoy the course =)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms