skeleton animation + nxOgre (maybe ragdoll)

valtovar

14-01-2007 01:23:39

hi, i need your help:
i have a mesh (human) and it have an animations (walk, run, jump, etc). i was trying to put ShapeGroup to cover it (sphere in the head, etc) and alright. But, when i run the animation, the shapes don't move with it.

This is my problem, i need that the shapes (i.e. sphere -> head) move (sphere follow the head) with the skeleton (of my mesh), how can i do that? if is ragdolls, can i use ragdolls with nxogre? or i must use it with physx directly?

Thanks for your help.

two: how can i do to change the position of a shape in a shapegroup?
i see that shapegroup have "vector" and i get the particular shape, but, how can modify the position of this shape?

shapegroup * sh = new shapegroup ();
sh -> addshape ( ... cubeshape1 ... );
sh -> addshape ( .... );


then:
cubeshape *cb = sh -> mshapes [ 0 ]; // get cubeshape1?
cb -> setPosition () // how?

thanks.

sorry for my english, i'm colombian (speak spanish)

betajaen

14-01-2007 10:34:17

Well of course they wouldn't. You need them as separate bodies attached together by joints.

valtovar

14-01-2007 23:49:54

i don't understand your answer :S

the shapes are separates, but, how can i do to change the position of a shape?

how can i do to join one shape to one mesh bone?

valtovar

15-01-2007 00:20:25

i have:


// get skeleton
sk = myCube->mEntity->getSkeleton ();

// get bone (called Mcabeza)
b = sk->getBone ( "Mcabeza" );

// create pos with vector3 position of the bone.
pose pos ( b ->getPosition () );

// set the postion to the shape, the position of bone.
( ( cubeShape *) chair1->mShapes[0] ) -> mShapeDesc.localPose.t = pos;


this code crash in the four line (set the position to the shape, the position of bone), why? can help me? i need the shape join with the bone. chair1 is a shapeGroup type

sorry, i have in the last line:
( ( cubeShape *) chair1->mShapes[0] ) -> mShapeDesc.localPose.t = pos.getVec3 ();

and don't work

betajaen

15-01-2007 00:20:47

You can't, not really. Well you can, but I wouldn't. Just use separate bodies and connect them via joints.

[Edit]

How would the pose class even work as a NxMat34? Hmm.

valtovar

16-01-2007 01:16:33

ok, but if i have:
( ( cubeShape *) chair1->mShapes[0] ) -> mShapeDesc.localPose.t = pos.getVec3 ();

getVec3 return NxMat32 alright? so? what is the problem? any idea?

SiW

16-01-2007 18:12:58

I'm wanting to do the same thing, and I don't understand why you have to use joints - is that the only way you can manually set the position of a shape?

betajaen

16-01-2007 18:55:05

Yes, it is possible. But every time you move a shape you have to update the center of mass, which does things. There probably a reason why it isn't in the Ageia Lessons, and why they use separate bodies for each piece for ragdolls.

If you want your character to have separate shapes for each limb then go ahead; If you want them to move around then use a body for each limb.

If you are serious about this sort of thing, ask someone on the Ageia's forum if it's feasible then if they say yes, we'll come up with some code.

valtovar

18-01-2007 15:05:20

You can't, not really. Well you can, but I wouldn't. Just use separate bodies and connect them via joints.


ok, but when i try
mScene -> createBody ( .... ); // body 1 on mesh 1
mScene -> createBody ( .... ); // i need body 2 on mesh 1


But i have two mesh in my scene, both with one body, so:
how can i do to put many bodies on a mesh?

Thanks xD

betajaen

18-01-2007 15:30:54

You do realise that if somehow you pull that off, that body a will move the mesh to it's position, then body b will move it back to it's position.

So it won't work. Like I said, if your serious enough to have some dynamic shape system per body/NxActor. Ask on the Ageia forums if it's actually possible and good on the solver, and we'll come up with some code.

valtovar

19-01-2007 15:13:14

but i need have the limb in separate files (head.mesh, foot1.mesh, hand.mesh)?, and use

mScene -> createBody ( .... ); // body 1 on head mesh
mScene -> createBody ( .... ); // body 2 on foot1 mesh
.....

yes?

and join each body (with meshes) with JOINS?

that is the idea?

or, just one "angel.mesh" (with head, foots, hands, etc) ? in this case, how can i do to put it many bodies <--- nxogre bodies?

betajaen

19-01-2007 15:46:50

Yes (to the first). But now your basically describing ragdolls.

valtovar

19-01-2007 17:51:43

ok (to the first), but i need is run my animation (with skeleton), in this case, you say: separate bodies and join with JOINS, but how can i do that with nxogre?

example:

1 -- i have angel.mesh: biped with run animation (by bones)
2 -- i have in my code:

myCube = mScene ->createBody (
"mikel", "Mikel.mesh", new sphereShape ( 5.0f, pose ( 1.5, 28, 1.5 )), 10.0f, pose ( Vector3 ( 0, 0, 0 ) ) );


but the sphere not it's the best shape to my biped, i can do it with more spheres (more than one), so i use groupShape.

2.a -- i have in my code:
chair1 = new shapeGroup();
chair1->addShape ( new sphereShape ( 4.0f, pose ( 1.5, 28, 1.5 ) ) );
pose pos ( 10, 18, 0 );
pos.set ( Quaternion ( Real ( 1 ), Real ( 0.1 ), Real ( 0 ), Real ( 0.5 ) ) );
chair1->addShape ( new capsuleShape ( Vector2 ( 4, 10 ), pos ) );
myCube = mScene ->createBody ( mikel", "Mikel.mesh", chair1, 1.0f, pose ( Vector3 ( 0, 0, 0 ) ) );



ok, to my mesh (biped) that is the better aprox. Now, i need move the shapes (sphere, capsules, etc) with muy bones 'cause the mesh (biped) is animated and i need more precision in my collisions.

here it's the problem,
1 - can i do move the shapes?
2 - can i do push more of one shape in my animated mesh?
3 - how can i do to cover my mesh (animated biped) with "shapes or bodies or anything in ageia" to detecte collisions and run my animations?

jejejejeje sorry, but i don't understand that and i'm sure that this is posible, i think that cellfactor have that.

Thanks

(write a tutoria with how cover a mesh (any mesh not uniform) with physyx ageia and run bone animations xD )

betajaen

19-01-2007 18:02:40

Will you stop switching around something which is easy to setup, to something that is ridiculously hard and even I would have some job setting it up properly.

This is what you do:

1. Each Limb (Head, Upper Arm, Lower Arm, hand,etc.) = 1 Body.
2. Each Limb has a mesh (head.mesh, upperarm.mesh, etc.)
3. Each Limb is joined together by either a hinge joint or a spherical joint.

Plan out the ragdoll on a piece of paper; sizes of the limbs, where they are in the world, and where the joints are.


Also what country do you live in?

valtovar

19-01-2007 18:09:00

Colombia, why?
mmm ok, i understand you now, .... but if i join with a ragdoll, i not use more skeleton animated?

[EDIT]
ok, i understand (its time xD), i use a box with my "walk animation" and ragdolls after (in explosions i.e.), i'm try to use (any similar to ragdolls) with my animations (all, walk, jump, run) and move the ragdoll following the skeleton (inverse to normal use: skeleton following ragdolls). Thanks for all.

mmmm now, do: ragdoll follow skeleton is posible? experimental?

Thanks betajeans :D

betajaen

19-01-2007 18:10:25

Because skeleton ragdolls are incredibly hard to setup, and require 1000s of lines of code.

valtovar

28-01-2007 23:20:27

Hi, had you see that? http://devsupport.ageia.com/ics/support ... eptID=1949, so ... its posible ragdolls following skeletical animations? it say that?

betajaen

28-01-2007 23:30:59

Yes, I already knew that. I'm pretty sure Epic and others were completely stumped that they couldn't implement a skeleton ragdoll system with PhysX so they had to leave it out of their games. :roll:

Of course it's possible, but rather than seeing if others have done it already. Have a go at yourself, you even have a bit of a head start since there is already a PhysX ragdoll tutorial.

jchmack

29-01-2007 08:10:38

Do you mean that you want something like (for example) your angel is walking and it walks into a box (kicking it) the box would go flying rather than just be pushed aside.

What you are asking (a physics model that uses animations that correctly interact with bodies) has not happened yet. Just look at most of the latest games. Even if you have the animations ... the mesh format is just pure vert data. Which means that the mesh is just updated each frame visually. Each vert or piece doesnt have a velocity or a mass for ageia to do calculations with.

So your solution seems to be just have a sphere (or whatever body) follow each individual part. If you do this then the sphere still doesn't have a velocity because you are teleporting it around each frame. And when it collides with an object the only force that would be pushing them apart is the force given by the skin width. Just look at how the character class interacts with bodies.

Also the .mesh format doesn't specify where your angel.mesh's arms and legs are. It just gives verts. There is no way (that i know of) of distinguishing between which verts are your head and which are your armpit.

If you were really serious about doing this you would probably want to make an exporter from whatever 3d modeling program you are using to export animation data as well. It is possible to extract based on keyframes (ive read .... somewhere). Then you would want to find out the velocities and masses of each collidable limb(arm leg etc). You could just set the mass and you could calculate the velocity based on deltaposition or the change in position since the last frame. Then test if there was a collision. Then apply the appropriate force.

You could also try to make the ragdoll animated first... Just set it up like betajaen suggested. Get it to walk around and stuff first then model the mesh over it. But dealing with objects like stairs would be ridiculous. Not to mention dealing with objects that your angel cant kick aside (static or kinetic objects).

But what you are asking doesn't seem very neccesary... If you don't mind me asking... what kind of application are you making? Even if you did get this up and running it would probably be very hard on the solver. The closest thing to a game that might need this would be a 3d fighter(tekken/DOA). And even they still use older methods.

I recommend you just let it go. It's difficult, unecessary, and impractical(for now). Im not trying to discourage you though. I honestly would love it if you could get this working (then sending the code to me :wink: ) Just warning you. Don't expect this to be part of NXOgre anytime soon. Betajaen is just one guy man. NXOgre isnt even version 1.0 yet.

valtovar

30-01-2007 20:52:31

ok, look that, how can i do that?





any idea?

that is from ageia 2.6.2 (and 2.7) -> rocket -> demos -> ragdolls -> hourse running (the exe)

betajaen

30-01-2007 21:04:04

Yes, from what I and jchmack, and the ragdoll tutorial says.