ebol
09-09-2007 00:53:52
Hi,
many words was spoken about ragdolls and accurate game character collision/raycasting, but I didn't find anything "ready to use" in the forums. Thats why, I present you me code, nothing much really, but I hope it will help someone and maybe someone will help me to finish it
UPDATE!
Both parts are working now, read further for some movies and updated code!
Anyway, what I did here is divided in two parts:
1) accurate game character collision/raycasting - I think many will agree, that using simple ex. capsule for checking if a character in the game world was hit is sometimes not enough. Now you can not only check if character was actually hit, but you can tell was it a head shot or maybe leg wound.
2) ragdoll simulation - you know it, you love it .... but unfortunately, its not ready yet, maybe someone will help me here.
Enough, how to use it:
you create ragdoll like this:
As arguments you pass:
where fileName is a text file with ragdoll data, like this one:
and then, if you want to use it as a accurate collision model, you call
or, if you want to use it in a ragdoll simulation you call
Then, you just call cRagDoll::update().
--------------------------------------------------------------
The first part works great, here's a screenshot (nevermind the headless guy ):
But I'm stuck on part two, which is controlling ogre bones via nxogre shapes. I read and tried tons of solutions, but I simply can't get it working right. Any help will be appreciated - maybe it's just me being tired and all, but can help, it would be great
Anyway, here comes the code, I'm still working on it - look for usage details there, enjoy, any suggestions, comments, questions etc are welcome
many words was spoken about ragdolls and accurate game character collision/raycasting, but I didn't find anything "ready to use" in the forums. Thats why, I present you me code, nothing much really, but I hope it will help someone and maybe someone will help me to finish it
UPDATE!
Both parts are working now, read further for some movies and updated code!
Anyway, what I did here is divided in two parts:
1) accurate game character collision/raycasting - I think many will agree, that using simple ex. capsule for checking if a character in the game world was hit is sometimes not enough. Now you can not only check if character was actually hit, but you can tell was it a head shot or maybe leg wound.
2) ragdoll simulation - you know it, you love it .... but unfortunately, its not ready yet, maybe someone will help me here.
Enough, how to use it:
you create ragdoll like this:
cRagDoll ragdoll("zombie.RD",zombie,"m1",mPhysXScene);
As arguments you pass:
cRagDoll(Ogre::String fileName, Ogre::SceneNode* characterSN, Ogre::String id, NxOgre::Scene* PHXScene);
where fileName is a text file with ragdoll data, like this one:
[Head]
boneName=neckcontrol
actorShape=capsule
dimensions=0.14 0.1 0.14
offset=0 0 0
[Torso]
boneName=Chest
actorShape=sphere
dimensions=0.22 0.22 0.22
offset=0.05 0 0.07
[Pelvis]
boneName=Waist
actorShape=sphere
dimensions=0.14 0.14 0.14
offset=0 0 0.1
...
...
and then, if you want to use it as a accurate collision model, you call
cRagDoll::setControlToBones()
or, if you want to use it in a ragdoll simulation you call
cRagDoll::setControlToBoneActors()
Then, you just call cRagDoll::update().
--------------------------------------------------------------
The first part works great, here's a screenshot (nevermind the headless guy ):
But I'm stuck on part two, which is controlling ogre bones via nxogre shapes. I read and tried tons of solutions, but I simply can't get it working right. Any help will be appreciated - maybe it's just me being tired and all, but can help, it would be great
Anyway, here comes the code, I'm still working on it - look for usage details there, enjoy, any suggestions, comments, questions etc are welcome