how create cloth physics in construct 3

0 favourites
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Thank you

  • Here is a more generic version.

    1. Place the cloth sprites wherever you want some cloth. It supports multiple instances.

    2. change the instance variables of the cloth sprite to change up the settings.

    a. resX, resY is the size of the grid that you want to simulate. bigger sizes are slower.

    b. diagonals turns on diagonal constraints. Makes cloth a bit stiffer.

    c. iterations will make the cloth less stretchy the higher it is. 1 is the default and fastest. More than 10 would be very stiff but very slow.

    https://www.dropbox.com/s/cl1205kk9cwjh3c/verlet_cloth_paster2.capx?dl=1

    Hello R0J0hound I wanted to do the same thing to construct 3 but I encountered some problems with the mesh method to construct 3 if you have time you can help me please. Only if you are not busy

  • Hi,

    What are the issues you’re encountering?

  • R0J0hound I can not set the mesh on the sprite I followed many tutorials but nothing if you give me an example please

  • Well in the verlet_cloth_paster.capx the distortion is drawn in events 15-17. Those are the only parts dependent on the paster plugin. Remove the paster plugin and the capx should be openable in c3 since only vanilla features are used then.

    I don't use c3 so I won't be making a cp3 example, but as i understand it you can make it work with distortion mesh with one action added to event 16. Somewhere you'll also want to set the x and y divisions of the mesh distort to cloth.resx and cloth.resy.

    for each cloth
    array: for each xy element
    -- set i to array.curx
    -- set j to array.cury
    -- cloth: set distortion point (i,j) to (p(Array.At(i,j)).x, p(Array.At(i,j)).y)
  • i did but it doesn't work, so right?

  • You probable should do "set mesh" at the start of the layout or something. It may keep resetting things there. besides, it would be set to the width and height of the array.

    And what are those two additional -1's in "set mesh point"? If they are uv's they could take i/(array.width-1) and j/(array.height-1) as values. If they are something else ignore that.

  • R0J0hound nothing distorts I changed those 2 minus 1 which are called texture x and y but it doesn't work but I don't understand why

  • I’m going to have to pass on this one and defer to other users that use c3 and are familiar with how to use the mesh distort feature.

    I’m avoiding using c3 so I’m not really much help here.

  • ok thanks

  • well, curiosity got the better of me...

    here is a C3 version of ROJOhound's file. Uses mesh and built-in functions.

    On my computer the C2 version uses about 40% cpu. the C3 version uses about 25%.

    I hadn't played with mesh yet, and turns out it simplifies what C2 had to do with the Paster plugin. There are probably more optimizations that could reduce cpu further.

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

  • Thank you very much

  • I would like to try to solve but I still don't understand much of the construct 3 meshes but on the ipad everything explodes and disappear because

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have had issues with Apple doing Instance IDs differently in the past, so I switch the project to use UIDs instead of IID.

    now it works on my iPhone and iPad... it blew up with the old version on mine too.

    My phone uses about 40% cpu, my iPad about 92% cpu.

    so, download from the link above for the updated version.

  • thank you. I have an ipad 2018 and an iphone 6s and they are both on 45% 50% 60% of cpu I think it's fine right? A final question if I would like to do the same thing with meshes, instead of just one sprite with a family could be done

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