-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changing collision shape dynamically in _process delays detection #44348
Comments
ello, I've done more testing and what seems to fix it is one of two things:
Note,
|
I'm unable to reproduce this. Using |
Ok. I'll try and get a demo project. I'm not using a rigid body or a kinematic body. |
@Demindiro and anyone else: Download my attachment and you need to do the following please to see it failing:
Now, go to line 35 in player_bullet_laser.gd and switch from _physics_process() to _process()
Note the distance between the two hits in physics/process is about 128 pixels. At speed of 360 this is 6 pixels per frame. Which means even taking into account a few frames dropped, it is taking 21 frames before it registers a collision after it should. I think. Which is way beyond normal, and regardless it is running at 60fps with no frame drops to even consider it is because it is 'too close'. When collision shape is not growing with _process or _physics |
I can reproduce the issue in 3.2.3 and in 3.2.4 beta 5, but it doesn't look like having debug collision on or off affects the behavior. |
Godot version:
3.2.3
OS/device including version:
Linux
Issue description:
I will provide test code if this is thought to be a bug (as it will take a while to create small sample).
I have an object (a laser beam) that starts small and gets bigger over the course of a few seconds. As it gets bigger (there is no scaling involved, this is purely a sprite/pixel visual thing), I am changing the area2d collision shape dynamically (in _process) every frame until it reaches a set size then I leave it at it's maximum size and make no more changes, i.e. this is the code while resizing
When at the largest size and not resizing, collisions happen exactly as expected. However, during this resizing phase there is a large delay in the collision detection triggering. Below is when the laser triggered hitting the object, as you can see, it's way past.
However when 'visible collision shapes' are enabled, firing at the same point, collision happens instantly as expected. Observe:
The rectangle between the player and the object (the laser beam) has triggered exactly on target. This also shows that the collision box is fine and in the correct location and size in the first example.
I am getting 60fps and there is no performance issue and this delay is not just a few frames it is maybe half a second.
So, I know the collision shape is fine but something is only triggering it properly during changing extent when debug is on.
I have tried a ray that I resize in the same way and that works fine, but I cannot use a ray due to requiring area collision boxes.
Am I missing something that 'view collision shapes is doing' or is there some kind of known extent resize issue with Godot?
Minimal reproduction project:
If this is seen to be a possible bug (i.e. just just a coding error) I will provide full code.
The text was updated successfully, but these errors were encountered: