Spriter Objects & Physics Ragdolls (Advanced)

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello, if you just got here please take a moment to read everything carefully before posting your suggestions and/or examples below!

    Background Details:

    For better understanding about the request I would like to go into some background details real quick.

    I bought a Spriter Pro license a few months ago and I really enjoy the benefits of using it in combination with C2.

    Currently I'm working on a large game with a lot of animations going on and just recently I wanted to create something that almost all modern 3D and 2D physics based games have: physics ragdolls.

    My Feature Request:

    Now to my feature request, I would like to implement physics ragdolls into my game.

    To be more specific, I would like to make a ragdoll animation that starts after a spriter object got hit (e.g. on collusion with bullet).

    I know that spriter objects contain each bone as sprites so my first attempt was using the example character (HERE), selecting each bone/sprite of the character and adding the physics behavior, then I did follow the official example with physics revolute joints.

    My basic idea was to enable physics for each part when the player got hit by a bullet, unfortunately after many failed tries it didn't work as I expected it to work and did result in weird wobbly physics glitches with sprites flying all over the layout. (I disabled all spriter events which manipulated the charactes position before starting the ragdoll.)

    The Summary:

    Now I'm back at the forums after using the magic search tool, I read through several topics about physics ragdolls but not one of them did fit my needs.

    At this point I'm not even sure if something like this would be possible to achieve with just a few events and without major performance issues.

    I know this is might not be as easy as I think it is but if anybody knows a possible way to achieve this, I would really appreciate to see some working examples with spriter objects including a physics "death" ragdoll.

  • You may have more luck with using the chipmunk physics behavior instead. It provides more control over adding joints. The built in physics behavior only attaches joints to the origin or image points of objects.

    So as I understand it, the basic Idea would be:

    1. give the physics (or chipmunk) behavior to all the bones, and have it disabled at the start.

    2. when you want to ragdoll, enable the physics and add joints between the bones at the pivot points (like the knee for example).

    Adding the joints is the only tedious part. Here's the capx you posted with the chipmunk behavior used. Press space to ragdoll (or mostly just scuttle) the player. I quickly added imagepoints on the objects to define where the joint should be, and attached the head all the way to one foot. It's not perfect, but this was mainly just for a proof of concept so I didn't fine tune it. However if you put the time in you can get it fully working.

    https://dl.dropboxusercontent.com/u/542 ... uttle.capx

  • You may have more luck with using the chipmunk physics behavior instead. It provides more control over adding joints. The built in physics behavior only attaches joints to the origin or image points of objects.

    So as I understand it, the basic Idea would be:

    1. give the physics (or chipmunk) behavior to all the bones, and have it disabled at the start.

    2. when you want to ragdoll, enable the physics and add joints between the bones at the pivot points (like the knee for example).

    Adding the joints is the only tedious part. Here's the capx you posted with the chipmunk behavior used. Press space to ragdoll (or mostly just scuttle) the player. I quickly added imagepoints on the objects to define where the joint should be, and attached the head all the way to one foot. It's not perfect, but this was mainly just for a proof of concept so I didn't fine tune it. However if you put the time in you can get it fully working.

    https://dl.dropboxusercontent.com/u/542 ... uttle.capx

    Amazing, thanks R0J0hound!

    I get what you did there and I should be able to work with it. It'll take some time and tests to figure it out but I'm glad that I finally got a way to achieve ragdols.

    I've got one question about that though, how is the performance impact? I will have a couple of enemies using this,

    so do I have to use the old fashioned "despawning" dead bodies (destroy by fade-out) way or can I keep them safely flopping around on the layout?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've got one question about that though, how is the performance impact? I will have a couple of enemies using this,

    so do I have to use the old fashioned "despawning" dead bodies (destroy by fade-out) way or can I keep them safely flopping around on the layout?

    It's always a good idea to optimize, especially considering physics, even if it's chipmunk. I suggest wait a few seconds after the ragdoll effect begins and turn off the behavior for that object. that way you still have your enemy bodies (so you don't have to despawn them), but the computer don't have to bother further physics calculations.

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