Collision problems using collision layers(no collisions , basically)

Costin25Costin25 Posts: 8Member
in 2D

i'm trying to combine the smooth movement with a kinematicbody2d that rotates (which would be the player ) the stick would be a sword .i can't seem to be able to make the player colliade with the wall (?) . i've put only one collision shape (on the rotating kinematicbody) , but the sword and the moving body don't colliade with anything . i used collision layers on the sword , moving body , static body and wall but i don't think it's because of that

-thanks in advance


Tags :

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 1,608Admin

    From what I remember, the collision mask is used to place the physics body on that layer. For example, if you have an object on mask 1 and 3, then collision objects on layer 1 and/or 3 will react to it. Looking at the pictures, I don't necessarily see anything amiss.

    One thing you could try is enabling all of the layers/masks on both objects, and then slowly disable each layer to see if you can figure out the right combination of masks/layers on both objects that will work as needed.

    Looking at the pictures, it looks like your wall (labeled Wall??) is a KinematicBody. I don't remember right off, but I think KinematicBodies do not collide with each other by default, which could be why the collision is not working. I would try enabling all the same layers/masks first though, as that is probably the more likely cause of the collision not working.

    Though to be honest, I'm not very well versed in collision layers/masks in Godot, nor really the 2D side. Hopefully this is of some help!

  • Costin25Costin25 Posts: 8Member

    i've tried changing the wall into a staticbody and kinematicbody a few times without very many changes
    i've also tried putting all masks checked to see what happens : it seems that the moving kinematicbody and its attachments don't colliade whatever i do with the layers

  • TwistedTwiglegTwistedTwigleg Posts: 1,608Admin

    Hmm, I'm not sure then.

    If the collision objects all have the same layers/masks, then the issue shouldn't be the collision masks and/or collision layers. Perhaps something else is causing the issue?

    Maybe make a new temporary StaticBody node and see if it collides with that? Also, how are you moving the KinematicBody node(s)? Are you using the move_and_collide and/or move_and_slide?

  • Costin25Costin25 Posts: 8Member
    edited July 21

    yeah , i think it's something else
    i don't use move_and_collide , it moves only with move_and_slide
    i don't know about the temporary StaticBody thing , i don't see why it would change (i tried it later , doesn't appear to change)
    i tried putting on the same layer too

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file