Skip to content
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

[Bullet] area_shape is 0 in body_shape_entered and body_shape_exited #19290

Closed
Tracked by #45022
Mavhod opened this issue May 31, 2018 · 10 comments · Fixed by #42711
Closed
Tracked by #45022

[Bullet] area_shape is 0 in body_shape_entered and body_shape_exited #19290

Mavhod opened this issue May 31, 2018 · 10 comments · Fixed by #42711

Comments

@Mavhod
Copy link
Contributor

Mavhod commented May 31, 2018

Godot version:

v3.1.dev.custom_build.43b7ebf

OS/device including version:

Issue description:

Steps to reproduce:

  1. Add Area node in scene
  2. Add CollisionShape with some Shape
  3. Add 2. more
  4. Connect body_shape_entered or body_shape_exited signal
  5. When body is intersected area_shape in function will always = 0 event if body had intersect any shape of Area

Minimal reproduction project:

@frostpitt
Copy link

I just wanted to add that I have found this to be an issue as well. Using Godot 3.06 and the latest Godot build from source built just a few hours ago.

To test:

  1. simply create an Area node at the center of a kinematic model.
  2. Have box shapes as child nodes to the above Area node and place them to the left, right, back and front of the model.
  3. Double click on the body_shape_enter and body_shape_exit signals to generate functions for them
  4. In the enter function, increment counters for left,right,back,front depending on the area_shape int (0=leftbox,, 1=rightbox, 2=backbox, 4=frontbox).
  5. In the exit function, decrement counters for left,right,back and front.

The above is being used to detect who is adjacent to a character. Placing a break point in the signal function always shows area_shape to be 0 regardless of which shape within the Area node it actually collided with.

@AndreaCatania AndreaCatania self-assigned this Dec 3, 2018
@AndreaCatania AndreaCatania added this to the 3.1 milestone Dec 3, 2018
@AndreaCatania
Copy link
Contributor

Can you please upload a sample project please?

@Mavhod
Copy link
Contributor Author

Mavhod commented Feb 18, 2019

See here:
https://www.dropbox.com/s/ixe9lv93jxjs1ib/testCollide.zip?dl=0

From sample it also have bug receive signal even it's not collided.

You can set "Project Settings->General->Physics->3d->Physics Engine" and set to "GodotPhysics", so it will be run correctly.

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Feb 27, 2019
@jknightdoeswork
Copy link

Just chiming in to say that I experience this issue as well.

@akien-mga
Copy link
Member

I can confirm the bug in the current master branch (ce75a2f).

It works fine with GodotPhysics using the project in #19290 (comment) (area_shape is respectively 0, 1, 2 or 3), but with Bullet it's always 0.

@akien-mga akien-mga modified the milestones: 3.2, 4.0 Jan 6, 2020
@KoBeWi
Copy link
Member

KoBeWi commented Feb 6, 2020

Turns out body_shape has the same problem. Here's a project (I wanted to make issue, but it would be pretty much duplicate):
ReproductionProject.zip

EDIT:
btw, 2D works correctly.

@AlexZan
Copy link

AlexZan commented Feb 14, 2020

Anyone working on this? Is it just a matter of replicating the solution from area_2d into area?

@19PHOBOSS98
Copy link
Contributor

it's still here on 3.2.3 rc3. Please for the love of everything that is pure and good someone fix it :'(

@chucklepie
Copy link

chucklepie commented Oct 8, 2020

hello, i don't know if this is the solution or an artefact of the problem (i raised ticket #42614, which was kind of more about lack of documentation and mixing up of parameter names). In the area_shape entered signal, the self_shape parameter actually contains the index of the shape not shape_id, which is always zero, so using this parameter gives the correct result. When you use body_shape enteredsignal is where it gets confusing as the index is called shape_id.

So, I dunno if simply the self_shape/shape_id are being mixed up or intentionally like this in area shape entered function?

@chucklepie
Copy link

chucklepie commented Oct 9, 2020

I've discovered something worse. I have two different scenes with area2D using multiple collisions and need to check for which collision polygon shape was triggered.

In my two methods, one always has area_shape parameter as zero and self_shape parameter as the collision index,
the other always has self_shape as zero and the area_shape the collision index!

I have no idea how it's coded or what's making it choose the parameter but it must have some logic in the code somewhere behind these two parameters causing it :(

If you want a video I am happy to share it. Can I produce a small program? I don't know because it's just random which method it chooses to set the index to.

func _on_PlayerSpawnPointCentre_area_shape_entered(_area_id: int, area: Area2D, area_shape: int, self_shape: int) -> void:
#this one uses self_shape!

func _on_PlayerEdgeDetection_area_shape_entered(area_id: int, area: Area2D, area_shape: int, self_shape: int) -> void:
#this one uses area_shape!

@pouleyKetchoupp pouleyKetchoupp changed the title area_shape is 0 in body_shape_entered and body_shape_exited [Bullet] area_shape is 0 in body_shape_entered and body_shape_exited Jan 20, 2021
@akien-mga akien-mga modified the milestones: 4.0, 3.5 May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants