Collision layer and mask issue
Asked Answered
C

2

0

Hi everyone, keep in mind I'm a beginner so I'm surely missing something obvious!

I have a generic item scene that defines a class on which I've set collision layers and masks (3 and 1,2,4 respectively, to be precise) in the inspector.

I have a specific item that inherits from the class above. However, the collision layers/masks are not what I want them to be when the item is instantiated. This happens even if I specify the layers/masks in the inspector for the specific item.
If I print the collision_layer and collision_mask in the ready() function, I get 1 for both values.

I've fixed the issue with by setting collision_layer=4 and collision_mask=11 in the ready() function, but I am wondering why this is happening so that I don't need to manually fix it.

Any ideas?

Cajole answered 30/1 at 17:39 Comment(0)
G
0

Cajole Could you show us some code and screenshots of your collision properties?

Gymno answered 31/1 at 11:11 Comment(0)
C
0

For sure, here are three screenshots:

  • Generic container item scene
  • Inherited container item scene
  • The output of the code in the ready() function from the inherited container. You can see that before manually changing the collision layer/mask, the values are set to 1/1.



Cajole answered 31/1 at 14:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.