Im trying to stop my sheep from moving through my fence using collision objects - however I don’t want my sheep to be affected by their own collision objects so I use this code:
Furthermore, Is there a better more robust way of stopping a game object passing through a wall. This only seems to work up to a point until they start to phase through the fence.
I have tried many methods to prevent one object from entering another, or passing through another. But in the end I was only able to do this with dynamic objects.
That’s what the group and mask options on collision objects are for. Set the sheep collision objects to have group sheep and mask fence, then set the fence objects to have group fence and mask sheep.
Do you have collision objects set correctly? E.g. does Mask property of fence matches Group of sheep and vice versa? Put a simple print inside your code and check if collision happens
Ahh, yes, I see you also made another post with a video, the approach is problematic:
Print out the values you are setting (or use debugging to investigate them)