Jump to content
nicoladanese

fit mass for bullet

Recommended Posts

Hey!

I have a bunch of pieces from a fractured geo, and I plug them into a rbd bullet sim. I have very big and very small pieces, which is fine, but the problem is that if I let the rbd packed object to calculate the mass obviously I get very different mass result (and that is absolutely correct), but you know, sometimes we don't want exactly the real thing ;) so is there any way of fit the mass so after is calculated I can fit it to more suitable values? I was trying to find a way of setting the mass in the fractured pieces and turn off the calculation in the rbd packed object, but I'm not sure if there's a way of calculating the mass at sop level...

thanks!

Share this post


Link to post
Share on other sites

mass = density * volume, so yes you can calculate that in SOPs.

In the rbdpackedobject DOP I couldn't find the place where mass gets computed (maybe I overlooked it) so if it's in there you can clamp it there. Otherwise I guess a sopsolver in combination with enableSolver DOP (so it only runs on first frame) plugged into presolve of rigidbodysolver should do it

Share this post


Link to post
Share on other sites

@3dome Correct, you must have overlooked it as you mentioned, under the Physical tab there is a tick bock "Compute Mass, a box to fill in Density and a greyed out option to fill in custom mass of an object. So my question for you would be, never having to use the presolve in rbd sims, apart from the pyrosolver, plugging the SOPSolver in the Presolve would essentially calculate the mass before running the sim? 

Share this post


Link to post
Share on other sites

@char that is not what I meant. I know that checkbox but I was talking about finding the place inside of the HDA where mass = density * volume; happens (checkbox ticked of course) [I think its happening in the solver]

After some investigation, turns out that if you solve on creation frame, the enable solver should be set to $SF==2, if you don't solve on creation frame, you have to account for that added timestep by setting $SF==3
That makes me pretty sure the mass calculation is happening in the solver.
If you go check in the sopsolver and see that mass acutally gets updated to whatever you want (comparing dopimport and your wrangle or whatever you use), once you go back up a level and see the result for mass it's back to the original value.
This is because although you set the mass in presolve, you still have the checkbox "calc mass" turned on so it tells the solver to do the mass calculation which will overwrite whatever you set in the sopsolver. I guess by default it only does it once (at the start of the sim) which is why after that the sopsolver overwrites the mass as expected.

So you cannot change the automatically computeted mass before the sim starts.

I hope that makes some sense and I need to say this is my personal conclusion from my tests, I might be wrong!

Edited by 3dome

Share this post


Link to post
Share on other sites

hmm tried to calculate mass in sop via a for each loop but no luck, I'll investigate further, thanks for your ideas!

Share this post


Link to post
Share on other sites
14 hours ago, nicoladanese said:

hmm tried to calculate mass in sop via a for each loop but no luck, I'll investigate further, thanks for your ideas!

why not? It's pretty simple. Put down a measure SOP to calculate volume, promote to detail as Sum, then multiply that value by the density value.

Remember that the mass in DOPs get calculated from the collision shape!

Share this post


Link to post
Share on other sites

oh btw I think I managed right now to apply what Char was saying, appended a point wrangle in a sop solver and override the mass seems to work, but I have to keep the "calculate mass" in the rbd packed object and override it every frame, otherwise mass go back to the calculated number

Share this post


Link to post
Share on other sites
1 hour ago, nicoladanese said:

Hey Dominik,

I'm struggling cause I have a bunch of pieces from a fracture, so I'm trying to apply this in a for each loop...attached an example

calculate_mass.hiplc

yes, for multiple pieces you need a for loop. see file.

1 hour ago, nicoladanese said:

oh btw I think I managed right now to apply what Char was saying, appended a point wrangle in a sop solver and override the mass seems to work, but I have to keep the "calculate mass" in the rbd packed object and override it every frame, otherwise mass go back to the calculated number

it shouldn't do that. I included the sopsolver stuff I was talking about earlier in the file.

dm_calculate_mass_and_sopsolver.hiplc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×