What is the term for this, or what should I be searching for:
A 3D Object fragmenting into independant objects
Getting a limb blown off
Showing other physical dismemberments
To be calculated in Real Time.
Let me know if my description is too vague.
They're called giblets :happy:
Just take your mesh and break it down into parts. You most likely already did this if you created a skeleton for your mesh. If the part is already closed (no open holes for each part), then to simulate dismemberment you just have to render the part away from the body. If you want to do real-time slicing and dicing, then you need to loop-cut your mesh along the fracture or seam, close it (triangularize the open areas: see how to triangularize a polygon), provide UV coordinates and normals for the new triangles, and texture it. I don't think there's any tutorials on this. It's all mathematical.
I want to hack a limb off my model, and have it calculate in real time. The cut can be made anywhere, in any direction. Not necessarily at a bone joint.
My thoughts are:
- Create verticies forming an elipse, equal to the plane the slice would form, around the limb.
- Separate the cleaved Bone into 2 parts (I don't know how this is accomplished in real time. I could shorten the original bone and create another, but this would end up shortening the whole mesh, and/or I'm lost).
- Triangulate any quads that were created.
- Treat the Separated Mesh with 6 DOF.
Does this sound like an accurate procedure?
maybe it sounds ok? if a little unexplained just yet...
would be insanely cool for a medieval sword+shield game tho
I haven't actually tried this out yet, just bouncing ideas around
Defining Vertices of a Solid where Intersected by a Plane:
Create a Transform T from the current coordinate system to a Frame A(x`, y`, z`) where:
z` = Slicing Plane's Normalized Velocity Vector Vn (Direction of Slicing Action)
y` = Axis along which Plane intersects solid
x` = Orthogonal to y` and z`
Create a Plane R, such that the Plane's equation in Frame A is:
, y, z
) = (0, 0, 0)x + (0, 1, 0)y
+ (0, 0, 1)z
for all Real x`, y`, z`.
Calculate the points where the Plane R intersects lines of the Solid.
For each line, consisting of direction vector l extending from one end of the line lo, calculate the Point P where this line intersects the Plane R:
d = ( (0, 0, 0) - lo ) DOT Rn _____________________ l DOT Rn
where Rn is a vector Normal to Plane R, which is (1, 0, 0), and d is the distance from lo to the Point P along the line vector l:
P(x`, y`, z`) = lo + (Rn * d)
Each of these points can be applied T(inverse) to be represented by the original coordinate frame.
You're on the right track. All you need is a point on the plane that will sever the object and the plane normal. Transform the plane into object space. Then proceed with your 3rd step. You can speed things by finding the first intersection point and then follow neighbouring edges to find new intersection data rather than test for intersections against all edges in the mesh.
It helps to draw a diagram and illustrate what you want to do.
You will need to update your VBO to include new geometry data and you will also have to update any bone data (if there is one). I'm not sure what the best way of going about that is. The "upper" portion that was cut will need to fall down while the other half will have to play some sort of animation. You will need to find out which bone intersects the cutting plane and act accordingly on that. I would probably construct a new "hip bone" to replace the sliced bone and adjust the bone weights accordingly. I would then use the new hip bone to animate the part falling while the other half does whatever.