COllision shapes between sprites not working

Godot Version

4.2

Question

so i have two instances of a same sprite , and they both have collision shapes attached to them and all , but still they wont collide , lik , they get stuck together without colliding

Are they in the same layer mask?

Yes they are in the same layer mask. Since they are instances of the same sprite

Can you post a image of the Cat nodes structure? And how are you moving the cats? Are you using move_and_slide() function?


no i do not use move_and_slide() , in the game , i use a mouse click control to pick up the cat nd place it any where i want , so the movement of the cat is lik , picking nd placing of object rather than arrow directional controls , i use the collision shape of the cat to find distnce to the mouse and if the range is under the set range , when mouse clicked , the cat’s global position will become equal to the mouse’s position

like, they dont push each other away or they just past thru one another (overlap)?

ya they overlap and become one single sprite :frowning: , uk if im not wrong , since ive given them a collision shape , there shd be some physical obstruction happening ryt ?
that isnt there

so i think the cats are clipped, since you teleported them to a position right?
have you put the move_and_slide() in the physics process of the cat? that should calculate the sliding

is it neccesary to move_and_slide() even if its just a pick and drop moevement and not a velocity based directional control movement ?

oh wait , it works now that i have added move_and_slide() , thank you soooo muchhhh! , sorry but can you explain why it was necssary to add that ??

it’s here explained : move_and_slide
it said

is intended to simplify the collision response in the common case where you want one body to slide along the other.

since you made them into collision to each other by teleporting, there will need calculation on how it will interact with the collision it got, since you didnt put the move and slide method in physics process, there will no calculation to move the cat when collided/overlap as to why it can slide with it

thankyou so much !

1 Like