[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Ragdolls in chipmunk.

Ragdolls in chipmunk.

Official forum for the .

Ragdolls in chipmunk.

Postby scorp » Sat May 10, 2008 1:56 pm

Trying to make a ragdoll. Knees should not bend forward, right? :mrgreen:

Of course, it is achievable with collision shapes... but that sucks.
Help! Urgently need better ideas!
Last edited by scorp on Mon May 19, 2008 9:02 am, edited 2 times in total.
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Joints with angle limitations. Possible? (making a ragdoll)

Postby scorp » Sat May 10, 2008 4:06 pm

It seems that I'm not the first one who asked this question. Oops. :roll:
viewtopic.php?f=1&t=44
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Need ragdoll-making tips. Got any?

Postby scorp » Sat May 10, 2008 4:19 pm

But i have another question:

I want the ragdoll to hold its pose. This was my plan:
rd.GIF
Red dot is the pivot, blue thing - cpDampedSpring with rest length a bit longer than the distance between anchors.

Plan did work, but not too well... lot's of glitches.
Any suggestions for plan B? :mrgreen:
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Need ragdoll-making tips. Got any?

Postby slembcke » Mon May 12, 2008 12:43 am

What was the issue? That should work alright.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Need ragdoll-making tips. Got any?

Postby scorp » Mon May 12, 2008 3:37 am

Doing more testing right now. Maybe I was wrong about cpDampedSpring causing glitches. I'll share my results here.

As for angle limitations, I used additional shapes instead of slide joints... works very nice... why the hell did I think that additional shapes sucked (see my first message)… :lol:
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Ragdolls in chipmunk.

Postby scorp » Mon May 19, 2008 9:55 am

Haven't played around with spring yet. Looks like I won't be needing it anyway.

Let's discuss general ragdoll making issues here. Topic of the message has been accordingly changed.

--------------------------------------------------


I'm working on a ragdoll-based game for iPhone, that's why ragdoll has to be as cpu-effective as possible.
My current ragdoll:
ragdoll.JPG


Red thingies limit the angles.

I really like how my ragdoll works, but keep wandering if additional shapes are more or less cpu-effective than using slide joints.

I'd be really grateful for all cpu-time-saving ideas.
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Ragdolls in chipmunk.

Postby slembcke » Mon May 19, 2008 5:37 pm

Slide joints should be way cheaper than using more shapes. It's a simpler constraint, and doesn't require all of the hullabaloo that goes into collision detection.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Ragdolls in chipmunk.

Postby scorp » Mon May 19, 2008 6:12 pm

And they are easier to use, as I have just discovered. :mrgreen:

Should have used them from the beginning instead of wasting time with shapes.
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Ragdolls in chipmunk.

Postby scorp » Sat May 24, 2008 9:33 am

New problem. :oops:

I need a way to address different body parts of N different ragdolls.
Like this:
player1.head->f.x=1000;
or
player2.shinR->t=-20000;

My plan was to create a RagDoll structure with cpBodies embedded in it.

typedef struct RagDoll
{
float BodyLength;
float BodyFat;
.... blah blah blah...
float Flexibility;

cpBody *head, *shinR, *thighR... etc etc;

}RagDoll;

Next step was writing a ragdoll-adding function.

void adddoll(RagDoll doll) //there is no space parameter yet, because currently I’m only using one space.
{

float BodyLength=doll.BodyLength;
float BodyFat=doll.BodyFat;

.... blah blah blah...

doll.head = cpBodyNew(0.2, cpMomentForCircle(0.2, 0, abs(SKX)*HeadSize, cpvzero));
doll.head->p = cpv(initX+SKX*(HeadSize/5), initY+SKY*(BodyLength/2+HeadSize));
cpSpaceAddBody(space,doll.head);

}


Ragdoll appears, but I can't address it's head. If I do, error appears "Unhandled exception at 0x004049cc in Chipmunk4MSVC2k3.exe: 0xC0000005: Access violation writing location 0x00000024."

Ok. Plan B.

cpBody *head; //additioanal cpBody
void adddoll(RagDoll doll)
{
.... blah blah blah...

head = cpBodyNew(0.2, cpMomentForCircle(0.2, 0, abs(SKX)*HeadSize, cpvzero));
head->p = cpv(initX+SKX*(HeadSize/5), initY+SKY*(BodyLength/2+HeadSize));
cpSpaceAddBody(space, head);
doll.head=head;
}

Same thing.

Plan C.

void adddoll(RagDoll doll)
{
.... blah blah blah...
cpBody *head; //additioanal cpBody, declared outside the function and structure

head = cpBodyNew(0.2, cpMomentForCircle(0.2, 0, abs(SKX)*HeadSize, cpvzero));
head->p = cpv(initX+SKX*(HeadSize/5), initY+SKY*(BodyLength/2+HeadSize));
cpSpaceAddBody(space, head);
}
player1.head=head;


It works! And it works with any number of players! But that's not very convinient.

adddoll(player1);
player1.head=head;
player1.shinR=shinR;
......................

adddoll(player2);
player2.head=head;
player2.shinR=shinR;
.....................

adddoll(player3);
player3.head=head;
player3.shinR=shinR;

etc etc etc

That sucks.


Why, why

adddoll(player1);
.................
doll.head=head; INSIDE the function

is not equivalent to

adddoll(player1);
.................
player1.head=head; OUTSIDE the function



I know it's not a chipmunk question. But I just don't get it (and can't find the answer in the net). Maybe someone here will help me.

Or maybe you can suggest a different method of addressing different parts of a ragdoll (presuming there are N automatically generated ragdolls)?

p.s.: Sorry for my not-so-good English.
scorp
 
Posts: 29
Joined: Sat May 10, 2008 1:41 pm

Re: Ragdolls in chipmunk.

Postby chipmunkuser » Sat May 24, 2008 4:22 pm

You have to make sure to allocate memory for any structure and pass in a pointer to it.
It's been awhile since I've done pure C structs (C++ and Obj-C now) so this may not be exactly right.

You could try:
void adddoll(struct RagDoll doll)

{


}
or alternately:
struct RagDoll doll, *dollPtr;
dollPtr = &doll;
dollPtr->head = 10;
void adddoll(dollPtr *doll)
{
doll->head = 10;
}

take a look at teh engine code to see how it's handled and check a C reference on passing a structure to functions.
chipmunkuser
 
Posts: 19
Joined: Fri May 09, 2008 4:48 pm

Next

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 5 guests

cron