Jump to content

fit mass for bullet


nicoladanese

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!

Link to comment
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

Link to comment
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? 

Link to comment
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
Link to comment
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!

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...

hey! sorry for the late reply, and thanks for the example really appreciated!

awwww now I see, this is what I was missing, is what you wrote in the post it "you can actually observe 3 different masses. first frame (DOP has not been solved yet) the mass is whatever gets set in SOPs, 2nd frame (DOP has solved 1 timestep) we get the computed mass, 3rd frame (our sopsolver is active only on that frame) the mass gets set to the number in the sopsolver"

thanks again!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...