Simulating Cloth Physics With Collision

Introduction

I used verlet integration to create realistic looking cloth. The finished result looks like this:

The Problem

Now I want to make this cloth look more realistic by implementing collision. This method creates several points, creates constraints between the points, and uses triangle meshes to create the cloth.

Using raycasting to check whether a point’s velocity is heading toward a part is a bit inefficient if this is being done for every point in the cloth, so I was wondering if there was any other way to check whether a point in space is colliding with a part.

6 Likes

Self collision, or collision with other objects?

with other objects, self collision isn’t needed

Can’t you just set the part’s CanCollide property?

That is probably the easiest but also least efficient way.

unfortunately i cant do that. the nodes that make up the cloth aren’t parts, they’re just vector3 values containing position, velocity, and acceleration. the triangles cannot be set to collidable because it will cause a lot of jittering and glitching.

2 Likes

How about collisiongroups? You can sort out from cloth to parts.

Could you show us your script so we at least know how to help you?

The jittering still happens with normal parts, not with just triangle parts. Look at the point module I just made, it’ll give you an idea of what’s going on.

Yeah no problem, didn’t think the script was needed bc all I asked for was how to check whether points are inside parts. Region3 and Raycasting aren’t going to work since Region3 treats points like regions and Raycasting is cpu consuming.

Can you still put it in, it would help a lot in solving your problem.

i did, i commented it, but i’ll put it in the post.