Jump to content

center of mass with HOM(VEX)?


Follyx

Recommended Posts

Hi,

found an interesting file from JOHNNY FARMFIELD

https://vimeo.com/farmfield

with name "FlipFluid Bullet deformation" https://vimeo.com/123758824 (attached). In the dopnet the RBD_Bullet1 node, in the center of mass you will find the following code:

obj = hou.node(hou.parm("soppath").eval())
dopnet = hou.pwd().creator()
if dopnet and dopnet.type().category() != hou.objNodeTypeCategory():
    dopnet = None
if obj is None:
    return 0
if obj.type().category() != hou.objNodeTypeCategory():
    obj = obj.creator()
p = hou.Vector3(obj.parm("px").eval(),
                obj.parm("py").eval(),
                obj.parm("pz").eval())
tp = p * obj.worldTransform()
if dopnet is not None:
    tp = tp * dopnet.worldTransform().inverted()
return tp[0]

As I'm relative new to it, please could someone explain it to me?

Thanks in advance

bullet.collide.v1.hiplc

Edited by Follyx
Link to comment
Share on other sites

That isn't my expression, though, it's the expression the Houdini dev's created to get the per frame center of mass position for the object, so if you tick that box in any RBD object, that's the expression that will be activated. :)

 

And you would usually not need to use this in simulations but in some situations, like here when the idea is to get the bullets rotating realistically, computing the center of mass just gives a better result. :)

Link to comment
Share on other sites

  • 2 weeks later...

Looking at the code it looks like it's a switch for evaluating the center of mass based on if it's in a DOP network or not, so if the object isn't in a DOP, it won't do anything, but if it's part of a DOP network, it'll set the center of mass as calculated by the current solver settings and evaluate any motion, shifting the center of mass in the direction of the velocity...

 

Or I'm completely wrong. :D

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...