Jump to content
The Dark Mod Forums

Trick to Make Concave Moveable Object


Ishtvan

Recommended Posts

I would like to document something, but I need some help to research it farther:

 

As you may know, traditional D3 moveable entities have restrictions on their collision model, one of which is that they can't be concave, such as a bucket, or a crate that's open at the top. Traditionally you have to make these things static, if you want the concave shape to be modeled physically.

 

There is a trick to get around this, and have something that is both moveable and concave, (e.g., a moveable box you can put things in): Use a ragdoll entity. Suppose you want a moveable box with no top:

 

1. Make it a ragdoll entity (this requires that it use an MD5Mesh for its model, more on that below)

 

2. In the AF file for it, set up the collision models (called "bodies" in the AF files) for all 5 faces you want to be solid (bottom and the sides)

 

3. Finally, add "fixed" constraints linking all of the sides together rigidly, since you don't want them to flop around

 

(I'm not sure this last step is actually necessary. If you have no constraints, it might just assume a fixed constraint with the origin body. Will check that now.)

EDIT: It is definitely necessary, otherwise they collapse into a bizzare heap. Which is not useful unless you are creating "crazy jellyfish-man." :)

 

You should then have a moveable box that you can put things in. Frobbing it and carrying it around will work a little differently, because in the current Grabber code, you cannot rotate ragdolls (usually, grabbing a body by the arm and trying to twist it off doesn't work very well). I could modify this to let you rotate about the origin body if a special spawnarg is present.

 

Remaining Questions (for modelers?):

Now you may have noticed the hard part: A ragdoll entity needs an MD5 mesh, and they need that single-frame animation, af_pose, just like our AI have. I'm trying to figure out the simplest way to do this, for this application. Do any modelers know the simplest way to take an existing model and make an MD5 mesh out of it? I think there is an export script for Blender? What about weighting, and making that single frame of animation? Since it's not actually going to be animated, is there any shortcut, like copy/pasting coordinates from the mesh into the md5 animatin file?

Link to comment
Share on other sites

You would need at least one bone, I think. Also, md5meshes are nonsolid by default...are you sure the cm you need to add to make it solid can be concave?

Link to comment
Share on other sites

You would need at least one bone, I think. Also, md5meshes are nonsolid by default...are you sure the cm you need to add to make it solid can be concave?

 

I think what he says is that each part is convex, but they form a concave whole. (But maybe I misunderstand this)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Yes, the md5 mesh itself does not have to be solid. You are adding all the solid parts in the AF file, by combining multiple convex CMs into a concave whole, like Tels said.

 

Our AI also work this way when unconscious. The mesh itself is not solid, but the physics is being approximated by the CMs defined in the AF file. (You can see this with g_showcollisionmodels on, or af_showbodies).

 

I don't think the MD5 mesh needs more than one bone/joint, since you could go into the AF file and define multiple AF bodies relative to the same bone/joint, just with different offsets. (I think, have to confirm that). All the MD5 mesh needs to do is render the model correctly. I'm not sure how much weighting is involved in that?

 

I can use our exisitng AI meshes as a test for now, I can just pick a single bone and try to build up a 5-sided box around that in the AF file, and see what happens. EDIT: There might be some weird effects if the md5mesh does have multiple joints and you have some joints not assigned to any AF body in the AF file.

Link to comment
Share on other sites

Success!

 

post-40-12649102784_thumb.jpg

 

I started with one of our simplest AFs, the bucket, with two joints. I then threw out what was there and then added a CM for each of the 5 sides, made the bottom face the parent and gave the other 4 sides a fixed constraint to the bottom. It seems to work, and it seems like only one joint was required in the MD5, the origin joint. D3 spits out warnings if you only use one joint for multiple AF-CM definitions "this body already includes this joint," but it doesn't seem to do anything bad.

 

First I made a small box, then I made a big box that the player can jump into (shown here). It works, in that you now have a moveable object with 5 sides and a space inside. You can put other objects inside it, flip it over and put it on your head, whatever. When I tried picking it up with other objects inside, it did seem to get stuck on the inner objects, but I think that might be because I set the mass of it low compared to what I had inside. I'll try giving it a higher mass and repeating that experiment.

 

As you can see in the image, the bounds (blue box) were weird, and this led to some rendering issues. I believe one can fix the bounds by text-editing the bounds info in the af_pose animation.

 

Now the question is, what are the minimum modeling steps required to achieve this? We need an MD5 mesh and a single-frame animation (with one joint). Suppose we only need one joint, "origin" in the MD5 mesh. That greatly simplifies the weighting, right? Does that mean you just export the model to MD5 and you're done?

 

As for the af_pose single-frame animation, since we only have one joint, we could probably just create that in a text editor (copy/pasting an existing af_pose animation as a reference, or we could make a template).

 

And the real reason behind my "conspiracy" : Could a modeler please export an MD5 mesh of the rowboat model? It can have just one joint at the model origin. Then I can build a 5-sided box for it, see if it floats, and if I can adapt the existing vehicle code to give it a push when the player is riding inside. :)

 

 

For reference, here is the modified bucket AF file that makes the 5-sided box:

 

articulatedFigure env_bucket 
{

settings 
{
model "phys_bucket"
skin ""
friction 0.0099999998, 0.0099999998, 0.3, 0.5
suspendSpeed 15, 20, 10, 10
noMoveTime 10
noMoveTranslation 5
noMoveRotation 5
minMoveTime -1
maxMoveTime -1
totalMass 10
contents solid
clipMask solid, corpse, body
selfCollision 0
}

body "bucket" 
{
joint "origin"
mod orientation
model box( ( -50, -50, 0 ), ( 50, 50, 4 ) )
origin ( 0, 0, 0 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
// containedJoints "*origin -*hand"
containedJoints "*origin"
}

body "test1"
{
joint "origin"
// large box:
model box( ( -50, -3, -5 ), ( 50, 1, 20 ) )
origin ( 0, -49, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
// containedJoints "*origin -*hand"
}

body "test2"
{
joint "origin"
model box( ( -50, -1, -5 ), ( 50, 3, 20 ) )
origin ( 0, 49, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
// containedJoints "*origin -*hand"
}

body "test3"
{
joint "origin"
model box( ( -3, -50, -5 ), ( 1, 50, 20 ) )
origin ( -49, 0, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
//	containedJoints "*origin -*hand"
}

body "test4"
{
joint "origin"
model box( ( -1, -50, -5 ), ( 3, 50, 20 ) )
origin ( 49, 0, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
//	containedJoints "*origin -*hand"
}

fixed "fixed1"
{
body1 "test1"
body2 "bucket"
}


fixed "fixed2"
{
body1 "test2"
body2 "bucket"
}


fixed "fixed3"
{
body1 "test3"
body2 "bucket"
}


fixed "fixed4"
{
body1 "test4"
body2 "bucket"
}

}

Link to comment
Share on other sites

And for reference, the smaller box:

articulatedFigure env_bucket 
{

settings 
{
model "phys_bucket"
skin ""
friction 0.0099999998, 0.0099999998, 0.3, 0.5
suspendSpeed 15, 20, 10, 10
noMoveTime 10
noMoveTranslation 5
noMoveRotation 5
minMoveTime -1
maxMoveTime -1
totalMass 10
contents solid
clipMask solid, corpse, body
selfCollision 0
}

body "bucket" 
{
joint "origin"
mod orientation
model box( ( -9, -9, 0 ), ( 9, 9, 4 ) )
origin ( 0, 0, 0 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
// containedJoints "*origin -*hand"
containedJoints "*origin"
}

body "test1"
{
joint "origin"
// large box:
model box( ( -9, -3, -5 ), ( 9, 1, 20 ) )
origin ( 0, -10, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
// containedJoints "*origin -*hand"
}

body "test2"
{
joint "origin"
model box( ( -9, -1, -5 ), ( 9, 3, 20 ) )
origin ( 0, 10, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
// containedJoints "*origin -*hand"
}

body "test3"
{
joint "origin"
model box( ( -3, -9, -5 ), ( 1, 9, 20 ) )
origin ( -10, 0, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
//	containedJoints "*origin -*hand"
}

body "test4"
{
joint "origin"
model box( ( -1, -9, -5 ), ( 3, 9, 20 ) )
origin ( 10, 0, 6 )
density 0.05
friction 0.0099999998, 0.0099999998, 0.4
selfCollision 0
//	containedJoints "*origin -*hand"
}

fixed "fixed1"
{
body1 "test1"
body2 "bucket"
}


fixed "fixed2"
{
body1 "test2"
body2 "bucket"
}


fixed "fixed3"
{
body1 "test3"
body2 "bucket"
}


fixed "fixed4"
{
body1 "test4"
body2 "bucket"
}

}

Link to comment
Share on other sites

Very promising. Be interesting to see how multiple items inside a box block it. Or is it only movers like doors that get blocked by two moveables?

 

I'm interested in this because I've made quite a few moveable brush constructions using a single brush as the moveable then using bind to bind other parts to it. The stepladder is the most complex. But I never tried with a flat panel base then binding 4 upright side panels either as a single func_static or 4 separate ones. I'm unsure if that would work to 'hold' items. And would it clip if turned over? I might try that out of curiosity. Anyway, the mesh sounds a better solution.

Link to comment
Share on other sites

The issue of getting blocked by objects on top of them is actually a physics-wide issue with one object stacked on top of another. It applies to simple stacked moveables as well, if you grab the bottom one, and the top thing is heavy enough. I don't think this performs any worse than any other objects stacked together. I'm pretty sure it will still be able to push two objects in series, it's just Movers that have trouble with that. But I can doublecheck.

Link to comment
Share on other sites

Hmm, AFs might be a little worse at moving with something on top them than moveables are, it's hard to tell. It might or might not be a fixable problem. We have done some fixes to rigid body physics over the years, it's possible there was a fix that AF physics missed out on that maybe we could replicate.

Link to comment
Share on other sites

Could a modeler please export an MD5 mesh of the rowboat model? It can have just one joint at the model origin.

 

If it's a .lwo I could look into it.

Link to comment
Share on other sites

I think it's already been determined and demonstrated that you can look into it; it's more a matter of can you put things into it; rattle them around; and then flip it over and have them plonk to the ground.

 

...or... um... er... nevermind. :P

"A Rhapsody Of Feigned And Ill-Invented Nonsense" - Thomas Aikenhead, On Theology, ca. 1696

Link to comment
Share on other sites

Ok, I've added an .md5mesh boat to models/md5/vehicles. I used the bfgcase skeleton because it had few bones. The entire mesh is weighted to "casebody".

Link to comment
Share on other sites

Okay, I looked at the boat, and I couldn't find the af_pose animation. I think that still has to be generated. It's just a single-frame animation where all the joints are in the same place as they always are. Maybe I could generate it in a text editor but I'm not sure.

 

EDIT: No, I don't know how to generate this part of the animation by hand, because I don't know what those coordinates are after the joints. They do not seem to be positions. Probably needs to be exported by an actual animation program. This is that part on the bucket, for example:

 

 

hierarchy {

"origin" -1 63 0 //

"hand" 0 63 6 // origin

}

Link to comment
Share on other sites

See if this works:

 

MD5Version 10
commandline ""

numFrames 61
numJoints 4
frameRate 24
numAnimatedComponents 0

hierarchy {
"origin"	-1 0 0	//
"casehandle"	0 0 0	// origin
"casebody"	1 0 0	// casehandle
"casetop"	2 0 0	// casebody
}

bounds {
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
( 0.000000 -0.173373 0.000000 ) ( 0.788541 1.388385 24.440119 )
}

baseframe {
( 0.000000 0.000000 0.000000 ) ( -0.000000 -0.000000 -0.000000 )
( 0.788541 -0.173373 6.560636 ) ( -0.000000 -0.000000 0.000000 )
( 0.000000 0.000000 0.000000 ) ( 0.000000 -0.000000 -0.000000 )
( 0.000000 1.561760 17.879482 ) ( 0.000000 -0.000000 -0.000000 )
}

frame 0 {
}

frame 1 {
}

frame 2 {
}

frame 3 {
}

frame 4 {
}

frame 5 {
}

frame 6 {
}

frame 7 {
}

frame 8 {
}

frame 9 {
}

frame 10 {
}

frame 11 {
}

frame 12 {
}

frame 13 {
}

frame 14 {
}

frame 15 {
}

frame 16 {
}

frame 17 {
}

frame 18 {
}

frame 19 {
}

frame 20 {
}

frame 21 {
}

frame 22 {
}

frame 23 {
}

frame 24 {
}

frame 25 {
}

frame 26 {
}

frame 27 {
}

frame 28 {
}

frame 29 {
}

frame 30 {
}

frame 31 {
}

frame 32 {
}

frame 33 {
}

frame 34 {
}

frame 35 {
}

frame 36 {
}

frame 37 {
}

frame 38 {
}

frame 39 {
}

frame 40 {
}

frame 41 {
}

frame 42 {
}

frame 43 {
}

frame 44 {
}

frame 45 {
}

frame 46 {
}

frame 47 {
}

frame 48 {
}

frame 49 {
}

frame 50 {
}

frame 51 {
}

frame 52 {
}

frame 53 {
}

frame 54 {
}

frame 55 {
}

frame 56 {
}

frame 57 {
}

frame 58 {
}

frame 59 {
}

frame 60 {
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...