Jump to content

Attracting rbd objects with constant force.


Zero

Recommended Posts

Hello there.

I am learning Houdini, so please be gentle if I'm not too savvy. What I am trying to do is this: I want to attract a selection of RBD objects in my scene to a given point in space. I have tried doing so with a uniform force DOP, but I am suspecting that I am doing something wrong. Basically, I tried to calculate the vector from the current position of the RBD object being processed to the "goal" position (a geo object). To get the position of the currently calculated RBD object, I use

pwd().simulation().findObject(str(lvar("OBJID"))).findSubData("Position").options().field("tx")

in the force component of the uniform force DOP. But it seems to always evaluate to the position of the LAST object (which ironically is the floor).

Basically, I would like to apply a different force to every RBD object in my group, and have that force point at the position of a given geometry node in my scene. I'm quite sure that I should NOT use the uniform force DOP, but I am a bit at a loss as to what I should be using. I think I'd know how to program this, but I don't know (yet) how to write my own DOP node.

So, any advice, hints, or well meant comment is welcome.

Edited by Zero
Link to comment
Share on other sites

Hello there.

I am learning Houdini, so please be gentle if I'm not too savvy. What I am trying to do is this: I want to attract a selection of RBD objects in my scene to a given point in space. I have tried doing so with a uniform force DOP, but I am suspecting that I am doing something wrong. Basically, I tried to calculate the vector from the current position of the RBD object being processed to the "goal" position (a geo object). To get the position of the currently calculated RBD object, I use

pwd().simulation().findObject(str(lvar("OBJID"))).findSubData("Position").options().field("tx")

in the force component of the uniform force DOP. But it seems to always evaluate to the position of the LAST object (which ironically is the floor).

Basically, I would like to apply a different force to every RBD object in my group, and have that force point at the position of a given geometry node in my scene. I'm quite sure that I should NOT use the uniform force DOP, but I am a bit at a loss as to what I should be using. I think I'd know how to program this, but I don't know (yet) how to write my own DOP node.

So, any advice, hints, or well meant comment is welcome.

You can use the force VOP to create a "goal force".

Its not the fastest node thou.

goalForce.hip

Link to comment
Share on other sites

You can use the force VOP to create a "goal force".

Its not the fastest node thou.

Great, that's exactly what I was looking for! Thank you so much for the .hip file.

As an afterthought: you mention that this node is not the fastest, any hints on how speed could be improved? Would it be a matter of writing the VEX code by hand rather then using the subnet? Or maybe use Python or C++ instead, and create something like a custom DOP?

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