Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blender collision export help request
01-29-2010, 09:53 PM,
#1
Blender collision export help request
I've googled 'til I'm blue and searched the fora, I keep coming back to the same two or three tutorials, and it doesn't work!! I know I'm doing something dumb, but I can't find it! Is anyone in here familiar with collision export in Blender? And have time for a newbie?

Assuming the answer is yes (and if it isn't then you don't want to read the rest of this post) then here's the setup:

I'm using:
Blender 2.49b
NifTools blender_nif_scripts-2.5.1
PyFFI 2.1.2

I'm modelling a bunch of carpenter's tools - mostly simple enough convex shapes, and for the collision I've hulled them with the script as convex poly and exported to nif: works a treat.

Then there's the drawknife - that's the blade on two handles in the pic. It's definitely concave. I started with a convexpoly and that was fine, but obviously it behaved unrealistically. So I've created a trianglemesh like this:

[Image: th_BlenderCollision.jpg]

Exported that to nif, which has a Mopped collision tree and everything - but now it acts like there's no collision, or maybe a very dodgy one.

I've tried small radius, big radius, Ridid Body - nothing seems to make a difference.

Can anyone spot the schoolboy error? It would be much appreciated!
Morcroft Darkes
Reply
01-30-2010, 12:38 AM,
#2
 
Hmm, not sure if I can help.So what Tutorial are you following? Is it this one.

http://niftools.sourceforge.net/wiki/Blender/Collision.

Thats the one I pretty much use. If it's something low poly I just duplicate it and follow this tut.Looking at my actor tab I don't even see "Concave Triangle Mesh" Will D/L nif when I get home and have a looksy.And what do you mean behaved unrealistically?
It takes guys as simple as the Dude and Walter to make a story this complicated... and they'd really rather be bowling.
Reply
01-30-2010, 01:11 AM,
#3
 
Hi there Morcroft,

I don't use Blender, but I know what is going on and what you can do to fix it:

Good collision for havoked/animated objects (are "simple" shapes):

*bhkcapsuleshape (is capsule shaped)
*bhksphereshape (is the sphere shape)
*bhkboxshape (shaped like a box/rectangle)
*bhkconvexshape (can sort of form fit around odd shaped objects, but a mesh with spaces will have the collision fill in those spaces and prevent things from going through those mesh's gaps)

BAD collision for havoked/animated objects:

*bhkPackedNiTriStrip/Shape (bad to use on anything)
*Mopped collision (like the collision above - is form fitting - but better for game performance <bhkMoppBvTreeShape>)

So for your object you're trying to use convex shape on, try using a bhkListShape with bhkTransformShapes under it, that in turn, each have a bhkboxshape under them. Yes, you can use multiple simple collision shapes under the same bhkCollisionObject/bhkRigidBody, by using the above that I just mentioned.

I think three box shapes will do nicely for your tool there, one on each side and one on the middle, horizontal part of your mesh. You can look at certain vanilla weapon nifs to see how it was done (like the great axes).

Sometimes, using this method will cause the item's havok properties to behave weird in the game. But to fix this issue the majority of the time, I use the bhkCollisionObject & bhkRigidBody of said vanilla weapon nif that also uses a bhkListShape (copy and paste into your nif), and I also copy over the NiStringExtraData from that vanilla nif.

You can change the havok material type to "OL_Clutter" in the bhkRigidBody that you just copied over to your new nif, but you don't really have to - both weapons and clutter collision material layer roughly act the same when grabbed/moved and both go into/out of inventory.

I don't know how to export multiple simple shapes from Blender, but I do know of this tutorial:

http://niftools.sourceforge.net/wiki/Blender/Collision

If you look at the pics of the tutorial I linked to, you'll see that it seems like the collision exported with a bhkListShape, with all the simple shapes already under it. You might still need a vanilla nif, though, for getting the bhkRigidBody/etc, because Blender and Max, to the best of my knowledge, still export bhkRigidBodys that lack certain necessary data for certain setups.

I made a ropecoil mesh for Blackmarsh's WIPz Quicksand mod, and used 13 bhkboxshapes under the collision object. I exported it this way from Max. but in game it acted funky. So I copied the vanilla data from an axe nif, then hooked my bhlListShape up to it, and the rope coil behaved excellent in the game.

Koniption
Yeah, don't let those little turds get you down. Dingleberries stick for a while, but eventually they fall off. Cool
Reply
01-30-2010, 01:18 AM,
#4
 
@shewter: Yes, that's the best tutorial I've found. The answer's probably even in there - I'm just not seeing it! And I watched a rather good You-Tube one that helped me figure out the basics.

"Unrealistic" as in "invisible force-field between the handles that sweeps things off the table..." Nothing unexpected, just what you'd think would happen when you fit a convex shape to a concave object.

"Concave TriangleMesh" is definitely what my version of Blender's calling a freeform mesh collision object. I'm guessing it's a newer name for the "Static TriangleMesh" referenced in the tutorial - that or there are some other settings I haven't played with yet.

I probably don't totally need that complex a mesh for this simple object, but I'd rather figure it out now than later when I really need it!

@Koniption: I'm deliberately avoiding working out how to fix this in NifSkope, if I can. Those nice people at NifTools are making a Blender plugin - and they're not monkeys so I want to work out how they expect me to use Blender and do it that way to get the best out of the toolset.

That said, you're absolutely right: three boxes, job done. Well, apart from the fact that I tried that earlier and had other problems which I think were about object centres but I'm not sure. I'll try that again too.

Mostly, though, I want to work out how to get the Mopped objects to work so I can use them when I need them.

You've come back to the best tutorial I found on my own - I think it's the only one out there that's really worthwhile.

I'm going to study your post some more in the morning (its 1:30am and I've had a few beers :cheers: )

BTW: Thanks both of you for looking into it: 'preciated.
Morcroft Darkes
Reply
01-30-2010, 02:02 AM,
#5
 
Quote:Originally posted by morcroft
[...] That said, you're absolutely right: three boxes, job done. Well, apart from the fact that I tried that earlier and had other problems which I think were about object centres but I'm not sure. I'll try that again too.

Oh, getting the object center to behave realistically is easy enough if you follow this tip:

In Blender, center the mesh and its collision directly in the center of the three axis(s), even if by "centering", the mesh/collision have to go under the other two axis slightly (X,Y - aka partially negative on the Z axis). Then export all, and in Nifskope, make sure the bhkRigidBody has the "Center" coordinates at all zeroes (it might automatically export from Blender with all zeroes, not sure). This usually works for most object.

Quote:Originally posted by morcroft
Mostly, though, I want to work out how to get the Mopped objects to work so I can use them when I need them.

The game engine does not handle havoked/animated items together with Mopped/bhkPackedNitriStrips on those items real well. I don't know if this is something that Niftools team can fix (though it can't hurt for them to try). Yeah, those collision types will seem to work in the game for such objects, but it does hurt game performance. With animated objects, for instance, Mopped collision has the tendencyy of having people fall through it when the animation starts (like elevators and such).

If you look at vanilla Oblivion nifs, you'll notice that the developers did not use Mopped collision nor bhkPackedNitriStrips/Shapes on animated or even havoked items - they only use simple shapes instead. If an animated nif, has a static part that is not directly animated within the nif, then Mopped collision can be used on that static part..but the animated parts in same nif can't use that type:

Look at the "meshes\dungeons\misc\dreamstairs01.nif", to see such a setup.

Koniption
Yeah, don't let those little turds get you down. Dingleberries stick for a while, but eventually they fall off. Cool
Reply
01-30-2010, 01:04 PM,
#6
 
OK, so Mopp is for statics only; and even then it's better to use one of the collision primitives you listed or the bhkconvexshape if necessary.

That's fine, I've played around with those already. The other problems were getting a bhkListShape, and getting the origin right. I found the solution to the first - in the most obvious place! There's a "use bhkListShape" button when you get to the NIFTools export screen. Duh!

The "Center" of the object was way off, though, leading to strange behaviour in-game (object "falls" to an angle off the floor, that kind of thing).

Reset the center of the bhkRigidBody to 0,0,0 in Nifskope: perfect in-game.

I can't seem to get the origin right in Blender. I manually manipulated the objects until their common centre is in the right place - but the exported centre is way off. I can't quite see how the two are related.

So unless someone knows how to move a bunch of objects in Blender so that their common centre is at the right origin for NifTools, I've failed in my goal of avoiding NifSkope. On the other hand, it looks like I just have to edit 3 integers in the bhkRigidBody node, which I think I can live with!

Thanks very much, Koniption. Really couldn't have done it without you.
Morcroft Darkes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)