Ball phases through a part with cancollide on?

I’m making a gambling machine for a game that doesn’t gamble with real money (don’t worry), it’s for a commission and I’m almost done with everything but I’ve noticed that the ball phases through some parts that are welded to main parts (both have cancollide on). Here’s a video:


(I also was looking for collission groups as well, checks out there as well)

2 Likes

Are the parts mesh parts? Make sure that the “Collision Fidelity” property is set to exact or whatever it’s called. Note: Having a lot of mesh parts with high collision fidelity may cause lag.

3 Likes

They are parts. asdasjidasodasda

1 Like

Are you rotating the parts with physics or by CFrame?

Physics doesn’t work properly when the other parts aren’t using physics (for example, if the ball hit a thing rotating with physics, it would gain velocity in the same direction when it bounces off, but if it’s by CFrame, the thing has no velocity so this doesn’t happen and the ball can clip).

If you’re rotating the pannels by CFrame you’ll need to rotate them with physics, or slow them down a bunch (though physics is the correct answer, as clipping can happen at almost any speed since the ball can be the one moving fast).

1 Like

How should i rotate them then? How would i do it with physics i didn’t understand that part.

2 Likes

You’d use an AlignOrientation (or a BodyGyro, though that’s depreciated), you’d create a joint then use an angular velocity, or you’d create a motor type one (I think they use Hinges for that? Idk, I have less experience with those).

Manually setting the CFrame isn’t physics based, so the physics engine can’t predict things like what the ball should do, which results in clipping. In fact, the only way the panels can move the ball in the first place is because of slight clipping that the physics engine is trying to correct (the panels are basically just teleporting inside the ball and the physics engine tries to fix it).

To modify your setup to use an AlignOrientation:

  • Add an attachment at the point of rotation
  • Add a rotation constraint there and set that up (either a Hinge or BallConstraint works)
  • Add an AlignOrientation with the settings for rotating around one attachment
  • Make sure the AlignOrientation has rigidity enabled
  • Then just change your code to modify the AlignOrientation.CFrame instead of the part.CFrame

Yeah if they’re all connected you could do that too as long as there isn’t anything in the way of them rotating freely.

1 Like

If your parts have Anchored set to true, it won’t matter that you’ve turned CanCollide off. You have to unanchor your parts and use some constraints for the rotation.

2 Likes

I have like 8 parts per row, everything is welded to the main part you see, so could i rotate the main parts with align orientation and achieve the same result?

1 Like

Worked :+1:, just gotta redo that system now :sob::sob:

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.