New to Corona - Any Radgoll Examples?

This example is great.

I just have a couple of questions…

With the first large code snippet, the ragdoll has no “strength,” and the second, updated code snippet, the ragdoll is more rigid, but his joints act weird, like arms and legs sticking up a little too unnaturally.

Also, how do you adjust the size? I tried changing doll1.xScale or doll.width and, while it changes the size, it also affects the range. For example, if I change the width to 1/2, it bounces off in the middle of the screen and doesn’t bounce at the wall.

[import]uid: 6084 topic_id: 3194 reply_id: 20513[/import]

I just manually changed the sizes of the rects and then changed the pivot points accordingly. Most of the values are based on the sizes of other parts so it makes it easier.

The second example uses friction joints which reduces the movement of the joints. You can play around with the values and make it resist more or less. [import]uid: 10243 topic_id: 3194 reply_id: 20576[/import]

Let’s reanimate this old thread ;).

Is it possible to animate the ragdoll as if it is walking?
Any idea how to implement such thing? (I’m new to corona ;)) [import]uid: 74852 topic_id: 3194 reply_id: 45059[/import]

This is a great example thread, I wish I had found it earlier. One area the docs and sample code seem a little sparse is with regard to complex body/joint construction.

I just wanted to chip in about co-ordinate spaces and groups, in particular with respect to achesser’s question above.

You don’t HAVE to add all the component pieces to a group, as done in the example above. You can just attach them with joints via global (ie, “content”) co-ordinates. If you do this, all the components will still exist in global co-ordinate system, and report all their values (x,y,rotation,etc) accordingly.

This is very useful if you want these components to interact with other objects specified in global co-ordinates!

For example, I have a spaceship with a gun turret attached via pivot joint. It makes more sense for these turrets to exist in the global co-ordinate space (instead of the ship group’s local co-ordinate space), since they need to aim and fire at other objects in the global space. Therefore, I do NOT add the turrets to the ship’s group.

If you do add the components to a group, you can convert local to global co-ordinates using the function: myGroup:localToContent( x, y ), and vice-versa with myGroup:contentToLocal( x, y ). But if you find yourself doing a lot of co-ordinate conversion, maybe ask yourself if your object is simply in the wrong co-ordinate space. :slight_smile:

For people familiar with CSS, display groups are a lot like a container with “position: relative” set; all children of the group will be positioned relative to the parent. Of course unlike CSS containers, groups can be rotated, etc, which makes things considerably more complex.

Also, per ridiculous’s original question: “1. Is there a way to create an “object” or “group” like my ragdoll with multiple parts without having to set their coordinates based on the global position?”, I think if you provide object(s) to the group in its constructor, the group will be centered on those object(s) and everything added after that will be relative to those objects. So in the above code, since the head seems to be the origin point of the ragdoll, I think you could initialize the group with display.newGroup( head ), and then everything you add to the group after that will be relative to the head’s position, instead of global position. [import]uid: 70530 topic_id: 3194 reply_id: 45124[/import]

First off, great examples and tutorial.

I had a question - how does one manipulate the entire body/object as one? For example, if I wanted to create a “rag doll cannon” or launch this body/object in its entirety? [import]uid: 75582 topic_id: 3194 reply_id: 108590[/import]

Have you tried applying a linear impulse to each body part simultaneously? [import]uid: 109535 topic_id: 3194 reply_id: 112648[/import]