About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Ragdoll on item objects
Author Message
Harry Offline
Member

Post: #1
Ragdoll on item objects
I try to make ragdoll in one item. I made bones and set it as ragdoll. Then a wrote this code:

Code:
Ragdoll ragdoll;
   Skeleton *skel;
   CSkeleton ctrlskel;

   skeleton=obj.skeleton();

   if(skeleton!=NULL)
   {
       ctrlskel.create(*skeleton);
       ragdoll.createTry(ctrlskel);
       ragdoll.active(true);
   }

But nothing happenes. How can I create a ragdoll?
11-09-2009 04:30 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Ragdoll on item objects
there is tutorial for creating ragdolls in physics folder
11-09-2009 04:54 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Ragdoll on item objects
Code:
Ragdoll sockRagdoll;
   Skeleton *sockSkel;
   CSkeleton sockCSkel;

  sockSkel=obj.skeleton();

create
if(T.sockSkel!=NULL)
       if(Contains(name,"Skarpeta"))
       {
           sockCSkel.create(*sockSkel);
           sockRagdoll.create(sockCSkel);
           sockRagdoll.fromSkel(sockCSkel);
       }
update
sockRagdoll.toSkel(sockCSkel); // set skeleton from ragdoll
draw
if(T.skeleton!=NULL)T.mesh->draw(sockCSkel);

Ok. I made some changes which you cans see before this sentence smile But now I've got this situation:

1) My based model which i put in World Editor still react as weapon, but it hasn't got ragdoll.
2) in Vec(0,0,0) position I've got now my item with ragdoll but it isn't works as weapon.

Where have I a mistakes?
(This post was last modified: 11-09-2009 11:26 PM by Harry.)
11-09-2009 11:26 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Ragdoll on item objects
maybe you don't have skinning in the model?
11-10-2009 12:11 AM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #5
RE: Ragdoll on item objects
I have skinning.

http://img43.imageshack.us/img43/2139/skarpetyy.jpg

Object numer one I set in WE in my world as weapon and I can put it in my inventory but it hasn't got ragdoll. Object number two is create in my code and it has got ragdoll but I can't put it in my inventory.

And I want to set created ragdoll on first item. What's wrong with my code?
(This post was last modified: 11-10-2009 02:17 PM by Harry.)
11-10-2009 02:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #6
RE: Ragdoll on item objects
I refresh the thread because I still can't put created ragdoll on proper mesh. How can I set this ragdoll to mesh which I put in World Editor? I tried this method:

if(Contains(name,"Skarpeta"))
{
sockSkel=obj.skeleton();
if(sockSkel!=NULL)
{
sockMesh=obj.mesh();

to find this mesh but when I start app I've got Break Continue error.

then I've got

sockCSkel.create(*sockSkel);
sockRagdoll.create(sockCSkel);

Everything is in create in Item.cpp. In update i've got

sockRagdoll.toSkel(sockCSkel);

When I comment this line: sockMesh=obj.mesh(); and draw created ragdoll I had it on 0,0,0 position.

Could somebody give me some tips?
(This post was last modified: 11-19-2009 05:16 PM by Harry.)
11-19-2009 05:15 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #7
RE: Ragdoll on item objects
I want to refresh this thread because I've got some progress but it isn't still what I want to do:

Create:
if(Game::Param *p=obj.findParam("sockRag"))
{
skel=obj.skeleton();
cskel.create(*skel);
rag.create(cskel);
}
update:
rag.toSkel(cskel); // set skeleton from ragdoll
cskel.clear().updateMatrix(actor.matrix()).updateVelocities(); // set skeleton animation to default pose and custom matrix
rag.fromSkel(cskel); // setup ragdoll from skeleton animation

Now I've got item with ragdoll but ragdoll doesn't work. When I turn off actor collisions model doesn't show. Second problem - when I put object in my arm ragdol is still on ground (not in actor.matrix). Could sb helps me?
12-07-2009 05:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply