Bert's CK Tutorials - Basic Collisions

Logged in as Guest | Group "Guests" | RSS
Thursday, 08/12/2016, 06:08













Home | My profile

Total online: 1
Guests: 1
Users: 0

Basic Collisions

For this tutorial I'll be using the bowl of apples again, for easier veiwing of the collision mesh I've
made the bowl and apples semi-transparent and as you can see below, because the bowl was the base object
it has a collision mesh (well, sort of, collision slabs anyway) but the apples don't, so anything that
was dropped on the bowl would instantly fall to the bottom and disappear from sight so what we need to
do is add a new collision mesh.
This tutorial will show how to use the in-built collision generation in NifScope to create a basic
collision mesh.
I'm also going to assume you've been through the Multi-Mesh Nifs & Merged-Mesh Nifs tutorials so know
how to add, remove and merge objects from the object tree in NifScope.

So, the first thing to do is remove the existing collision mesh.

Now create a new NiNode and copy your objects into it, in this case it's just the bowl and the merged apples.

Merge all the pieces together into a single mesh.
Note: because the apples had HasVertexColors but the bowl didn't I switched the apples to No to get them to merge.

Now, generating new collisions with NifScope can be a bit weird as it creates the new collision at 10 times the
size of the original so to fix this you need to rescale the fully-merged-mesh down to 0.1 but cannot use the
default Scale settings as these will be ignored so to fix this right-click the NiTriShape of the full mesh and
select Transform/Scale Vertices.

Set each option to 0.1 and hit Scale.

If you zoom in you'll now find a mini version of your merged object.

Now in the object tree select your mini-mesh, right-click and select Havok/Create Convex Shape.

In the new window that pops open set the Rounding-Off Value, this dictates how close to the original mesh the new
collision will be, for starters I'll try at 0.1

As you can see NifScope has now generated a new collision with 13 Vertices & 12 Normals which is a fairly low
count for this object.

While this would be perfectly acceptable for a standard static object it would'nt be so great for a clutter object
as parts would disappear beneath whatever it was laying on if not upright.

So I've gone back a step and this time set the Rounding-Off Value to 0.01 and the mesh is now much closer to the
object shape.

And in-game you now have a fully collisioned object!

When satisfied with the new collision mesh delete the mini-mesh used to create the collision.
All done!

berticus0001



Copyright MyCorp © 2016