Clingy girlfriend physics

Godot Version

4.3 beta2

Question

i’m working on pathfinding. For fun i have Rufus pathfind through Ash. Sometimes Ash gets knocked off the screen, which is hilarious, but a lot of the time if Rufus hits Ash at an angle (not head on) Ash sticks to Rufus and follows him everywhere. Sometimes i can scrape her off on a tree but otherwise he’s stuck with her.

Both Rufush and Ash have circle colliders. Attached picture zooms in on that.

Stats:

             Rufus     Ash
Layer            3         3
Mask           12        123
Safe Margin    1.0     0.08
Motion       Floating  Grounded
Wall Slide     0

i’ve tried playing with numbers, randomly changing things to see if they make a difference. The only change that’s done something is if both Mask on 3 then Ash becomes immovable (which isn’t nearly as funny) and if i remove both from 3 then Rufus goes inside her (which is not cool).

i’m still shocked two circles can attach. Any ideas on how to make them interact properly?

Have you tried switching the motion mode on Ash to ‘floating’?
The ‘grounded’ motion mode is intended for stuff like side-view platformers and the like, and I’m thinking that ash’s characterbody thinks Rufus is a moving platform and sticks to it once it’s on top.
(See ‘MotionMode’ in the docs)

Also, as for collision layers vs masks, the layer is which collision layers the body itself is in, while the mask is which layers it checks for collisions when it moves. So assuming that you want them both to be able to collide and not be able to move through eachother, then you’ll want them both to have layer 3 checked in their collision masks.
Here’s the section in the docs on collision layers and masks.

3 Likes

Ash thinks Rufus is a platform. How degrading. But you’re right, making them both floating seems to have fixed it.

When both are on layer 3 then Rufus hitting Ash causes Rufus to slide around and Ash doesn’t move at all. i don’t know why but that’s a different problem for a different thread. The clinginess issue seems to have been solved.

1 Like