Physx3 ragdoll progress continues, slowly...

30 posts Page 1 of 3
chriscalef
Posts: 332
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Wed Mar 18, 2015 5:10 pm
Hey, just thought I'd update this forum too, in case people aren't tracking the other one... nothing too exciting, not game ready yet (for one thing, you can't create a ragdoll anywhere except the origin at the moment :-P ) but at least there is a working dude you can kick around now:

(And btw, does this forum support vimeo/youtube/etc videos directly?)

https://vimeo.com/122503184

In case anyone doesn't have them already from the thread on gg.com, the relevant repos are:

github.com/ChrisCalef/Torque3D/tree/physx3_advanced_WIP

and for the game directory,

github.com/ChrisCalef/physx3_advanced_game

Obviously there are joint limits / stability issues, but the biggest problem is whatever I'm doing wrong with the base node transform. When you move it away from the origin the physics bodies get moved twice as far, or something. It should be a fairly simple fix but I have other work coming up now so I gotta put it down. Suggestions welcome (cough cough, Timmy, cough). :-)

Anyway, that's where it stands for now. Good luck on all your Torque projects!


EDIT: oh yeah, if you should bother to download and play with it, "alt g" is hooked up to give him a vertical impulse, the guy is named $m4 (for michael4) and there is a function called applyImpulseToPart() or aitp() for short, which is used like this:

$m4.aitp(2,"0 0 0","0 0 1500");

where "2" is the bodypart index (going from 0 at the hip to 4 at the head, and then arms and then legs), "0 0 0" is the origin of the force relative to the bodypart origin, and "0 0 1500" is the force vector.
Johxz
Posts: 411
Joined: Sat Feb 07, 2015 11:37 pm
by Johxz » Wed Mar 18, 2015 5:48 pm
chriscalef wrote:(And btw, does this forum support vimeo/youtube/etc videos directly?)


Yes, I think is:

[youtube]7gKYT5NpZeg//Your video number[/youtube]

but don't know for vimeo.
JeffR
Steering Committee
Steering Committee
Posts: 741
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Wed Mar 18, 2015 6:06 pm
Pretty sure it doesn't currently. It should be added though.

OT:
Looking pretty nice there. Looking forward to having good, stable ragdolls in the engine proper :P
J0linar
Posts: 46
Joined: Thu Feb 05, 2015 8:50 pm
by J0linar » Thu Mar 19, 2015 1:27 am
hey chris thats cool,
i would bet that gmk`s ragdolls might contain a solution and btw it looks like that the ragdoll itself isnt really exposed to script so thats another thing that needs to be checked/added.
Will take a look at your work, as i did played around with gmk ragdolls and fixed those more or less (stretching issue for example) i might be able to get somewhere with your base.
t3d would certainly benefit from ragdolls physx and bullet based ones ofc.
chriscalef
Posts: 332
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Thu Mar 19, 2015 5:54 am
Thanks everybody

Re: GMK, yeah, I think I've dug my own hole here by now though. It shouldn't take that long to figure out what's going wrong when I get a good solid day on it, but I happen to be out of time at the moment.

Re: script access, for my current build the way you create ragdolls is by adding a regular physics shape, only with two new members added to the datablock: bool isArticulated = true and S32 shapeID = a valid PhysicsShape ID in your sqlite database (physicsData.db).

When I first started down this path I made all the bodyparts and joints in script, with datablocks, but it quickly escalated into a totally ridiculous number of datablocks being used up on physics, so I switched everything over to sqlite. I included a little free software sqlite frontend called sqlitestudio in the game repo - it's a little clunky but is a lot better than nothing.

In the database, there are three useful tables so far: physicsShape, which is basically just a name and an ID to link all the parts together; physicsShapePart, which contains all the rigid body properties for one bodypart, plus a link to the joint; and px3Joint, which defines the properties of a joint that could be reused many times in the same skeleton.

Debug draw mode is turned on and off with physicsDebugDraw(bool), or pdd(bool) for short.

I haven't exposed different debug draw modes to script yet, but they're easily found in the source code, in Px3World::onDebugDraw. You can define whether it draws joint limits, bodypart axes, bodypart collision shapes, and set the overall scale of the axes/joint limit rendering here.

Anyway, that's the basic lowdown on how to use it, as it currently exists. I'll make this thread my announcement area for future progress.
chriscalef
Posts: 332
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Fri Mar 20, 2015 5:22 pm
Ha ha! No time to commit, but I got up early this morning and fixed the transform problem before work! By way of evidence, here are multiple ragdolls:

Image
JeffR
Steering Committee
Steering Committee
Posts: 741
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Fri Mar 20, 2015 7:11 pm
So that pretty much just leaves joint limits then?
chriscalef
Posts: 332
Joined: Mon Feb 09, 2015 7:48 pm
by chriscalef » Sat Mar 21, 2015 2:25 am
I think so... unless there's some deeper problem somewhere waiting for me. Got tomorrow free so I should be able to hit it pretty hard.

Looking to add joint motor forces very soon as well, and then I also need to write the kinematic part of the equation - when the body is animating, it needs to drive the physics parts in kinematic mode, so they can find collisions, etc. and also to start ragdolling in mid action sequence instead of only from a standing position. Shouldn't be very difficult though.
Timmy
Posts: 307
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Sat Mar 21, 2015 2:53 am
To get the correct pose i solved this by passing in the dead player object id via script to the ragdoll class (obviously server side) and than resolving the ghost and copy the transforms, this saves copying the transforms over the network which would be horrible. Once this is done it's safe to delete the player. Bare in mind i did it this way because i have no need for ragdolls unless they are spawned from a dead player.

I really regret not creating a GUI tool to help create the ragdolls, boy it's a slow, boring and tedious job setting everything up by hand.
Timmy
Posts: 307
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Sat Mar 21, 2015 3:05 am
I will also say it's a been a long battle getting the joints and the drive parameters right but i finally got it right just yesterday. I just added in support for aggregates into the PhysicsBody class too, hopefully this keeps performance under check in a heavily populated physics scene. I also found upping the joint solver iterations helped stability of the ragdolls too. Hope that helps but looks like from the video you not far away nailing it anyway :mrgreen:
30 posts Page 1 of 3

Who is online

Users browsing this forum: No registered users and 1 guest