# detachable limbs

This topic is 4974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How do I do this?

##### Share on other sites
not just limbs, but stuff like guys getting chopped in half

##### Share on other sites
need a lot more info to be helpful. what model format, what API?

##### Share on other sites
I've been wondering what the best method for doing something like this is, myself. Say you have a solid SkinMesh, but want to allow a forearm to get blasted or cut off. Do you make an entirely new model missing that part? Not very flexible. Do you leave the parts disconnected? Visible cracks suck. Do you give each part of the body a different material ID, and dynamically change the mesh by removing and inserting faces (you would need to insert a bone / insides of the mesh).

I'm working on a zombie game, and I'm definitely going to have to allow some dismemberment :)

##### Share on other sites
Well, physics wise (what I guess a3a2004 wants to know) I'd say you duplicate the node the limb is attached to.

If this is the arm (the uppercase O is the shoulder)

-O---o---o---

you duplicate the shoulder note

-O o---o---o---

so that the arm is a seperate unit.

As for the mesh, I'd suggest keeping the ones that are 'arm only' and 'body only' as the are and remove those that linked arm to body and replace them with some kind of 'flesh' face to close the respective mesh.

=====          ==\   /==--O--  -->     --o   o--=====          ==/   \==

Something like this :) Hope you appreciate my crappy attempt on ascii art [cool].

You'll have to find a way to store which faces are shared between limbs and which nodes are detachable...

##### Share on other sites
.x and directx graphics (9).

##### Share on other sites
u could model the mesh with cracks, but make sure the points on the seam use the same normals (so it doesn't look like there's a seam). this will be harder if the mesh uses welded normals, but it's still possible.

also, depending on how complicated u want to get, u could move the vertices that make up inside of the limb (the part u see only when the limb is severed) to the end of the vertex buffer, then when the limb is severed just render that many more vertices.

##### Share on other sites
This is a pretty game specific question... Assuming your game is 3D with skinned characters, one way to do it is to have separate limb meshes (just a leg, just an arm, just a head, etc.) When a limb is severed, scale the root of the limb by 0, making it disappear on the main mesh, and then draw the detached version in it's place. The detached version can be moved anyway you'd like, for the best effect it would be a ragdoll, but it could use a canned animation also. It'd also be a good idea to have some blood spray from the wound (particle system.)

There are of course a million other ways you could do this. You could simply have static meshes for each possible lost limb, for example.

##### Share on other sites
What about getting cut in any place and having the two halves slide off of each other? This couldn't be done with that method.

##### Share on other sites
I think you would have to get very detailed to accomplish that. As in modeling as many possible splice types and having an inside for each one. Then just picking the closest match when a cut happens. You have to split at vertices, so I think it would be impossible to make it perfect. Edges of polygons run one way or the other. I don't see how you could make a diagnal-left slice AND a right. Not unless you used diamond shaped quads in your model, but then you can't do straight splits.

It could easily become a complicated mess :)

##### Share on other sites
yah it would be a mess to support 'dynamic seperation'. splitting mesh triangles by a plane is simple enough in theory, but u wouldn't be able to pre-compute any of the interpolated texture and normal coordinates for the split triangles. it would take quite a while to do real-time.

also, if u have other engine elements such as skeletal animation it would be a nightmare to dynamically choose with bones to assign new triangles to (or point weighting for soft skinning).

##### Share on other sites
thought of a possibility: detect the entry and departure points of the cutting object, then calculate the nearest point with one of the coordinates an integer(x,y,or x) for each. Then use a few more of these semi-integral points and add one more in the middle, then connect them like this

0
0 - 0
- -0
0 i
0 0

and so on, just making triangles with those points and the center, animation is a moot point because the guy will be dead, with limbs I can use one of the mentioned methods

##### Share on other sites
A plane slice would not be that bad. But unless you don't care about detail, the inside "guts" will be a nightmare. You could just simply generate polys over the holes and slap an "organ" texture on it, but it would probably be difficult to make it look decent. Or, slack off detail and just paint it red / black.

Unfortunately, my zombies can still animate after they get torn up. I was thinking of just making about 2-3 splice points on each arm / leg, and have "guts" props standing by. When a peice gets torn, just lock a gut prop to the bone that should control it, and avoid rendering the material id of the sliced off section afterwards. It may be possible to make a quick mesh-copy of the material to allow it to bounce around the room, or I could just model seperate limbs.

Fortunately, I'm not going "Return of the Living Dead" on it, and I don't have to worry about arms trying to come after the player :)

##### Share on other sites
sort of want it to look like kill bill, was just planning to slap a texture on it and do a good job with the particle system

game will be a sword based game, so all cuts will pretty much be plane cuts

##### Share on other sites
Have you played Blade of Darkness? Its like 5-10 bux at most stores now and is a vastly underrated game of this type. It has the features you mention, though I think the cut points were pre-set.

Highly recommended game though. And remember, the Knight w/ elven sword is best.