Player Keeps Getting Launched Into The Sky

Godot Version

4.3

Question

I’m new to Godot and I’m trying to follow a Godot 3D tutorial (Your first 3D game — Godot Engine (stable) documentation in English) to get an understanding of the engine, I’m at the point where I’m coding the enemy spawning but I’m having some problems.

The problem I’m having is that whenever the player sits in the middle of the platform they just launch off the screen, and it only happens in the middle, and sometimes enemies will get caught on the center or get launched as well. This problem only appeared after I coded the enemy spawning so I’m sure something in it is causing the issue but I can’t find it.

Enemy Code (Referred to as mob):

Level & Spawning:
image

Scene:

1 Like

If you upload your project to Github, I’ll download it when I have time and take a look.

I have it here: GitHub - R-Tricontahedron/GodotPracticeProject

Thank you in advance for offering to help with this.

looking at it now. this bug is amazing so far.

The problem is that for a split second, the mob spawns in that location. This imparts an enormous collision force on the objects. Then your mob gets placed in its intended location.

I don’t know what the “best” or “right” solution is. But the quick and dirty fix was to open the mob scene and set its y-transform to 100. Now it initially spawns 100 m away. Problem solved (moved?)

I think another strategy would be to have collisions disabled by default on the mob and then enable collisions after you initialize the position.

Also, you would need to check that it isnt inside the player before doing so, or you will launch it again.

Last bit of general advice:

When you upload to github, you dont have to zip to. In fact, it is better not to. Take a look at Kenney’s start project.

Also, if you are not already, I would definitely recommend using git or github for version control to keep your sanity as the complexity of your project increases. It is very nice to be able to go back to any checkpoint and be able to explore what-ifs and being able to undo it and have your project back to where it was.

1 Like