Projectile collision issue: Dodgeball when shot backwards bounces off my own character and shoots forwards

I have a dodgeball gear in my game and recently re-coded my projectile system to move away from BodyMovers and use ApplyImpulse(). I want the dodgeballs to physically-correct interact with one another. So now here is the unique problem I have encountered which I did not have before.

When you click to throw the dodgeball behind you, the projectile spawns at the characters hand and is given an impulse to launch it backwards. The issue I have is the dodgeball actually ends up flying backwards from the hand and colliding with the players torso/body parts, hence bouncing off of them and launching forwards.

Does anyone have ideas to momentarily disable the dodgeballs collision only with the player who shot it? Or another idea to successfully throw it backwards without it colliding with the players own body and bouncing off of it?

If you would like to avoid two parts, each with CanCollide set to true, from colliding then perhaps you should look into using CollisionGroups though the PhysicsService.

1 Like

I would recommend doing this. You can just set a collision group for each player and make it so that the dodgeball that is thrown doesn’t collide with a specific player.

Yeah I am aware of PhysicsService but the game has 50 players… I cannot have 50 CollisionGroups

You can try making just 2, one for the dodgeball, and one for the character whos throwing it. Make it so that the dodgeball can’t collide with the character, but will collide with the default collision group.

You can destroy these collision groups after a few seconds to avoid stacking collision groups.

I don’t think this would be an issue, as these CollisionGroups only have to exist momentarily as you can simply remove them when un-needed.

If you truly wish to avoid using CollisionGroups you could for example simply disable the dodgeball’s CanCollide for the first tenth of a second of its lifetime.

Valid point! I will explore this option.

The solution below works! I am not super happy with it’s implementation but hey, if it works then it works! haha


	Projectile.Instance.CanCollide = true