how create cloth physics in construct 3

From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • yes, a family would work fine - just put all the instance variables that are currently on the Cloth sprite on the family object.

    family objects can't be a container, so you will have to create an Array instance for each family member and manually Pick it with the family...

    (I normally would give the family object an Instance variable called ArrayUID and store the Array's UID to make picking easier.)

  • Thank you

  • I would like to apologize again but if I would like to do drag and drop with the touch

  • ok, I changed the way Drag and Drop works - uses touch, and you don't have to touch one of the points, it picks the nearest one on the cloth that you touch. (so you can't miss)

    I didn't change it to use a family because of the Array issue and the Limit function needs two instances picked at the same time, which makes that a little more complicated (you either need two families or pick the first instance and save its position, etc.)

    so, instead I made the cloth have different frames for different images (used flags as an example).

    https://www.rieperts.com/games/forum/ClothFlags.c3p

  • thanks but there is a problem those on the sides do not take them because you do not touch the flag how to solve

  • don't worry it works great

  • oh, just uploaded another version... now you can toggle showing or hiding the Dots, and I made the dots bigger (the way ROJOhound had them), and if you touch a dot, it drags that one (so the edges work better).

    re-download the link above if you want to see what I did.

    EDIT: also made which ever cloth you drag move to the top of the layer

  • thank you so much

  • hi sorry again R0J0hound AllanR but i was wondering if you could create mesh in any position you want in runtime please. if you can also give an example

  • the sample I posted does create the mesh at runtime.

    In event 3, the second action - Cloth -> set mesh

    it then goes on to create a dot over each mesh point. I used ROJOhound's code to create the dots. Take a look at the "Mesh distortion" sample project on C3's start page for an alternative way to create the points using lerp.

    If you mean create the mesh points in some random location, then no. You have to create a grid of dots over the whole image, in as many rows and columns you want. Once the mesh points are created you can move any point, but that will then distort the image.

  • yes. I meant to create random stitches. thanks anyway

  • the mesh has to be a grid of rows and columns. But there could be a way to select which mesh points are allowed to move/be affected by the "cloth" motion routine.

    you would have to show some kind of example or mock-up of what you had in mind.

    the way it is now assumes the top two corners are anchored and don't move. that could be expanded to anchor other points on the mesh.

  • you could move an entire column or row without affecting the texture and after choosing the position make it move with verlet mode and distort the sprite texture

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The example just did a grid mesh of points and edges since that’s fairly simple to do, results in a nice uniform simulation and finally because it matches what c3 can do with its distort mesh, which also is a uniform grid.

    You could conceivably put points anywhere you wanted and have edges all over. The issue is it’s tedious to setup. Also it wouldn’t be simple to make work with the distort mesh.

    Just thinking aloud though.

    Where there’s a use case and an interest to do it there’s a way. What you want to do is still vague.

  • R0J0hound I would like to create meshes where I want at any time and position

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)