Jump to content

quick way to keep attribute the same value


Recommended Posts

What is a quick way to make an attribute stay the same after it receives a value. I get data from dops on frame 8 and I want the value to stay the same after the collision ends on the next frame.

I've tried this in a detail attribute create:

if collision happens
  get data
if not
  be equal to this detail

But it erases on the next frame.

Thanks.

Link to comment
Share on other sites

I forgot to mention it is in a SOP solver. :D I just need an expression that holds a value once it receives one. I'm sure it is something simple I can't think of

Probably would help to see a file, but one thing to make sure is that you are not creating the attribute inside the sop solver before doing the check or else each frame the attribute would get reset. Best to create any attrs before feeding it into the solver.

Link to comment
Share on other sites

You can try:

if ($COLLISION == 1,$DATA,detail(surface_node, attrib_name, attrib_index))

But like Manuel said this will be reseted at the next frame to maintain accumulation of the values you have to use SOP solver.

I hope this helps.

Cheers!

Link to comment
Share on other sites

Edit: I got it to work. Use apply data with empty data going into the data input, and modify data after apply data. In modify data create 3 variables, x,y,z and now the expression works. I was trying to get fields to hold values but I guess you can't and actually need data.

if(
dopfield($DOPNET, 1, "Impacts", "Impacts", 0, "positionx") != 0,
dopfield($DOPNET, 1, "Impacts", "Impacts", 0, "positionx"),
dopoption($DOPNET, $OBJID, "hitpos", "x"))

where hitpos is the name of the data and x is the name of the subdata

Edited by stephenl
Link to comment
Share on other sites

  • 9 months later...

Edit: I got it to work. Use apply data with empty data going into the data input, and modify data after apply data. In modify data create 3 variables, x,y,z and now the expression works. I was trying to get fields to hold values but I guess you can't and actually need data.

Hey Stephen, Can you post a simple hip using this trick?

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