# Determine if fracture piece is broken off or not..?

## Recommended Posts

Hmm, if I feed a fractured object into DOPs, there just gotta be a simple way to determine if a piece is broken off or not, right? Or do I need to set something "manually", start checking distances to neighbouring pieces or alike?

And this is fractured RBD's, not packed primitives, as I'm doing per piece stuff in a SOP solver. Just so that's clear.

Edited by Farmfield

##### Share on other sites

You can examine the rest position and see if that is different than the actual position. That will tell you if the piece has moved since the start of the simulation.

```if (v@P.x != v@rest.x){
f@is_moving = 1;
} else {
f@is_moving = 0;
}```

##### Share on other sites

Aah, no, that won't help. Think about like you wanted to color any broken off piece of a fractured object.

Worst case scenario I have to set something up manually, measure relative distances on a per piece basis and split them up using some kind of limit - but I was hoping for a simpler solution.

##### Share on other sites

Something like this maybe?

SOP_PiecesRelativeBreak_v01.hiplc

##### Share on other sites

Also non-pacekd version ( a bit broken with the rotations :/ )

Edited by rayman

##### Share on other sites

My problem is I need to identify single pieces only. My ideas so far is to either use the debrissource SOP and measure the amount of source points (one exposed prim will equal one value, two the double, etc) against a limit - or perhaps dissect and mod the debrissource subnet to fit my needs. My second idea was to measure the centroid of each piece to the centroid of its neighbouring pieces (the connect adjacent pieces would work for that), then compare that distance to determine if a piece is disconnected or not. Dunno how the connectadjacent pieces sequences itself, but I might be able to use it in SOPs and again in DOPs using a SOP solver and compare between the outputs...

And I just love how I get these ideas that seems so simple at first but turns out to be surprisingly complicated to figure out - especially if you, like me, want to uncomplicate it into a really, really simple solution.

Edited by Farmfield

##### Share on other sites

Can you compare the velocity of each piece vs the whole? So if the velocity is different then we know something must have changed and it broke off. I guess it would also need to then remove that piece from the "whole" calculation. Was messing around with it but I haven't used non packed stuff in forever, don't see a v attribute. Failed at the first step smh.

Connect adjacent sounds better though, think thats the right way to go.

##### Share on other sites

Well if you check the files above you can see that there is a "broken" attribute which is float.  broken=1 means that all connections to that piece are broken, so it is a single chunk. broken>0 && broken<1 means that some of the connections to that piece are broken.

I modified the file again, so it now works much better with non-packed. Red pieces are single chunks (broken=1.0), yellows are partially broken.

SOP_PiecesRelativeBreak_v03b.hiplc

• 2

##### Share on other sites

Aah, I missed that, Pavel, the attribute. I've been locked up with other stuff so I didn't take the time to dig into your setup deep enough - that's on me, sorry.

Here's what I came up with - the single wrangle, though, haven't managed to figure out how to compare two arrays in an if statement...

Edited by Farmfield
• 1

## Create an account

Register a new account