Silgrad Tower from the Ashes

Full Version: Creatures - Collision & Constraints by Copy/Paste
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all,

I have regularly come across questions on how to copy/paste collision and constraints properly from a vanilla creature to a custom creature. So I have decided to upload a tutorial I wrote for someone else, here, regarding just how to do that.

But first, to make a custom animated creature, follow and read the following tutorials by Saidenstorm:

On the Wiki:
http://cs.elderscrolls.com/constwiki/ind..._Creatures

Saidenstorm's personal website:
http://sites.google.com/site/saidenstorm...stutorials

Ok, so once you have finished modeling, rigging, and animating your creature (you need at least a single idle.kf animation, to test to see if you did the next tutorial part correctly...I suggest holding off on the other animations, until you've gotten the collision and constraints correct. However, that's just my personal preference), follow the information for setting up creature collision and constraints, below (sorry for the big paragraphs):

In Nifskope - Collisioning the Skeleton:
Open up a vanilla creature skeleton.nif that uses a bhkRagdollConstraint under one or more bhkBlendCollisionObjects (let's use the ones on the Rat creature's tail - so open up the Rat's skeleton.nif).

Make sure that "Render" -> "Draw Constraints", "Draw Nodes", and "Draw Havok" are enabled and checked in Nifskope. Open up your creature/intestine skeleton.nif. We want to add collision starting with Bip01 Intestine1 (first intestine bone). The collision is "green" (OL_Biped layer in bhkrigidbody) in Nifskope.The constraints are represented by those "orange" colored shapes, etc. The orange cone shapes are bhkRagdollConstraints, and can allow creature's bone joints to move in all 4 directions around a pivot point. The wider the opening of the cone, the more space it's attached bone can "wiggle" within it to the edges of that cone's opening.

Copy and Paste the Rat's Bip01 Tail "NiStringExtraData" into the Bip01 Intestine1 node of your custom skeleton.

Detach the collision from the Rat's Bip01 Tail node by going into the NiNode of Bip01 Tail, going to "Collision Object", and to right of that, doubleclick the field and press "Delete" on your Keyboard. This unhooks the collision from the NiNode. But the hook-up is "two-way" - we need to unhook the NiNode from the collision. So go into the bhkBlendCollisionObject, go to "Target", and to right, doubleclick and press "Delete" to this, too. Now we can copy and pasted the collision without an error message.

So rightclick -> "Block" -> "Copy Branch" the whole highlight bhkBlendCollisionObject and in your custom skeleton, in empty window space...rightclick -> "Block" -> "Paste At End". Rehook the collision to the Bip01 Intestine1 node, and the Bip01 Intestine1 node to the bhkBlendCollisionObject. Be sure to use their respective "numbers' that represent them in Nifskope (numbers are to left of their names). It's the reverse process of when we unhooked the collision. You'll see a green sphere appear at the Bip01 Intestine1 node of the creature's skeleton.

Add another vanilla creature NiStringExtraData to the Bip01 Intestine2 node. Now we add collision to this node/bone, but this time, we'll also add constraint. Click on one of the rat's tail collision capsules in the Nifskope render window, that still has a orange cone-shaped constraint within it. You'll see that the other text window highlights that bhkcapsuleshape collision in blue. Follow this up to the bhkBlendColliisonObject right above it, and do the same detachment procedure to the bhkBlendCollisionObject that we did previously for the other Bip01 Tail node of the rat. However, also go into the bhkragdollcontstraint under that bhkcapsuleshape, expand "Entities" and delete both the bhkrigidbody's on the right side (doubleclick -> delete on keyboard). Copy over that whole detached collision and hook it up to Bip01 Intestine2 node, same as before, but this time go back into the bhkragdollconstraint, go to "Entities", make the first entity the bhkrigidbody that the ragdoll contraint is directly attached to, and the bottom, 2nd entity the bhkrigidbody of the Bip01 Intestine1 node's collision. The “Entities” of the ragdoll constraint only accept “bhkrigidbodies” as entries in the fields.

Lastly, go back to the Bip01 Intestine1 node, and add a bhkragdoll constraint to it's bhkrigidbody (go into Block Details of nifskope for this bhkrigidbody, and towards bottom of page, you'll see the field to hook up the ragdoll constraint). Make the number of “Entities” a 2, then click on the green arrows to make those two fields expand. Make the first “Entity” field the bhkrigidbody that this ragdoll constraint is directly attached to, and the 2nd Entity the bhkrigidbody that comes prior in hierarchy to the Bip01 Intestine1 node (which might be the Pelvis node, in your case, since intestine seem to be logically close to that bone). Constraints' entities are connect in this backwards fashion.

Expand "ragdoll" under "Entities", and rightclick, "Havok " -> "A-B" ..you'll see the cones line up. But the cone(s) might be facing the wrong direction, as the green collision might be, too. We want cone's wide opening to face towards the end of the intestine that hangs loose. The green collision capsules should be big and long enough to cover each ninode that they correspond to. We need to play with the values under "Ragdoll" to achieve proper cone direction:

Plane A, TwistA, Plane B, Twist B

Each of the 4 fields above must have only one (1) axis (XYZ) be a value of one (1), or negative one (-1)..and the rest of the axis in each field a value of zero. You'll have to play around to get the right cone direction. As you change the number values, watch the changes to the cone in the render window. When it looks correct (cone opening facing outwards towards end of intestine), do rightclick, "Havok" -> "A-B", again. If the cones align while pointing all outwards - Good. Sometimes the cone's seem to be pointing in right direction after your changes, only to be the wrong direction once you align then with "A-B"...just keep playing with the numbers til you get it right. I don't fully understand the number changes myself, so even I have to play with the values with each new creature.

"Cone Max Angle" is the # that determines how wide the cone's mouth/opening is. The larger this value, the more the bone can pivot in any direction around a circular path of the cone's opening. I made that value the same as "Plane Min Angle" and "Plane Max Angle", so that the cone's mouth is perfectly circular, yet a little larger around.

The first bone with collision in the tree hierarchy (Bip01 NonAccum), has the lowest "Col Filter" and "Col Filter Copy" number value, which in Oblivion creatures, begins at a value of 2. Oblivion usually has the second bone/node with collision in the hierarchy (usually is the Bip01 Pelvis bone, like in the Rat skeleton) a value of 2 as well. Any bones below the 2nd bone/node in hierarchy, that also have collision, are one number value higher each, as you work your way down the chain. See the diagram I sketched up for you, named LinkedBonesFlagHierarchy.jpg . You'll need to set up the Col Filter and Col Filter Copy of your custom intestine bones in similar fashion. The Col Filter and Col Filter Copy are always the same number value, in respect to each other.

Be sure to give each custom node of your intestines a Mass value in rigidbody. Make the node closest to the body center a higher mass value than the intestine node at the very end. So like, Intestine1 (near body center) will be Mass of 10, Intestine2 a Mass of 8, Intestine3 a Mass of 6, Intestine 4 a Mass of 4, and Intestine5 a Mass of 2, etc. The mass needs to graduate downwards in value as you reach the end of the intestines. The reasoning is this: if you pick up the tip of the intestine laying on a ground, you aren't picking up much mass...but if you pick up from where the intestine meets the Pelvis/body center, you also are most likley picking up other parts of the intestine and therefore the weight should be heavier.

Lastly, go in game with your collisioned creature and kill it. It should ragdoll and flop to the ground, without the meshes stretching into infinity (which is a sign of improperly set up constraint(s) somewhere). If part of the creature does stretch into infinity, then make note of what part of the body or general body area this occurred at, and check similar area in the skeleton.n nif, by double-checking your collision and constraints.


Koniption

PS - If I made any mistakes in writing up this collision/constraint tutorial, please tell me where I erred. If someone wants to add this info to the CS wiki, be my guest - but be sure to link back to this thread and also credit me in the wiki document you setup. Thank you.
Thanks for sharing this useful info. Smile