Jump to content

dopfield expression and ActiveValue


asnowcappedromance

Recommended Posts

hi everybody!

I created a dopnet in which I activate rbd objects based on their distance to eachother,

for this purpose I used the ActiveValue Node. (sphere hits brickwall, bricks get activated if the distance threshold is lower than a certain value)

The active value node only takes in the brick groups as a mask.

Now the bricks that get hit by the sphere get an active value of 1 and the collision happens, but as soon as the sphere passes the bricks and continues

it's route, the value switches back to 0.

My idea was to get the bricks into a new group as soon as they got activated, but I get an error message when I try to use the following expression:

if(

dopfield(

$DOPNET, "brickobj_" + ($OBJID-3), "SolverParms", "ActiveValue", "active"

) == 1, 1, 0

)

would be nice if someone could help me here,

best regards,

Manuel

Brickwall.hipnc

Link to comment
Share on other sites

Try,

if(
    dopfield(
            $DOPNET, "brickobj_" + ($OBJID-3), "SolverParms", "ActiveValue", 0,"active"
            ) == 1, 1, 0
  )

I don't know why but it likes to have a 0 in there...

At least no error now. Does it work for you Manuel?

Edited by Macha
Link to comment
Share on other sites

If you add this expression, without if(), does it work? Since it evaluates to 1 or 0 anyway I think if() would be unnecessary. The dataname is hinted at in the ActiveValue node.

It seems to switch on and off the groups with the correct members according to the Active value.

dopfield($DOPNET, "brickobj_" + ($OBJID-3), "SolverParms/ActiveValue", "Options",0, "active")

Edited by Macha
Link to comment
Share on other sites

haha, indeed interesting Macha ;)

ok you are right, I looked up the dopfield expression in the help and you have to use a "/" if you're addressing subdata.

it seems that the whole setup works incorrectly because my distance expression does a weird thing even before the active value gets 1.

In the new file I've created "CustomData" with holds the distance value and there are 2 problems that I don't know how to solve:

a) all the bricks share the same value instead of having a distinct value on its own

B) the value starts with 0 and increases as the sphere approaches the bricks.

thanks again for your help, maybe you can figure it out ;)

regards ...

Brickwall.hipnc

Link to comment
Share on other sites

haha, indeed interesting Macha ;)

ok you are right, I looked up the dopfield expression in the help and you have to use a "/" if you're addressing subdata.

it seems that the whole setup works incorrectly because my distance expression does a weird thing even before the active value gets 1.

In the new file I've created "CustomData" with holds the distance value and there are 2 problems that I don't know how to solve:

a) all the bricks share the same value instead of having a distinct value on its own

B) the value starts with 0 and increases as the sphere approaches the bricks.

thanks again for your help, maybe you can figure it out ;)

regards ...

Have not looked at your file but type your condition into the activision of a modify data-DOP, set the type to boolean, value float to 1 and type a nice name into value 0 name. As soon as contition is met it will create and store the named data. You can now put that object into a group by putting dopoption($DOPNET,$OBJID,"Position","yourDataName") in group expression.

The important part here is that the data will not be destroyed when condition is no longer true.

Cant give you a file now but will post one later if you cant make it work.

Link to comment
Share on other sites

thanks for the reply Mawi, I will have a good look at your file tomorrow!

I just solved the grouping issue on my own, I think my solution goes into the same direction as yours.

I created an attribute "hasbeenhit" with a modify data DOP as it was suggested in one of the tutorials of the gnomon dynamics DVD.

However, this doesn't resolve the distance expresson problem that I described earlier.

Any suggestions why my values start from 0 and increase instead of being large at the beginning and getting smaller over time?

Brickwall_edit_02.hipnc

Link to comment
Share on other sites

If you look at the Position data you see that all objects start at 0,0,0. I don't know why it does that but could you find a way to get at the original world position and then add it to each?

I admit, a bit of a hack...

They don't do that in mawi's file so I guess it is a glue object specific thing. I dimly remember having such a problem a while ago.

Edited by Macha
Link to comment
Share on other sites

Something like this here appears to give the right distance.

While doing it I noticed that your initial position of the sphere SOP does something weird to the dops position, so I moved the it into the geometry context.

I got to run now so I don't have time to pursue it but that could be one of the problems.

Brickwall_edit_dist.hipnc

Edited by Macha
Link to comment
Share on other sites

I didn't have the time to work on the issue today, but it's a common thing that objects get the coordinates 0,0,0

when importing the into a dopnet either with RBD Glue Object oder with the RBDfracturedObject.

it's very annoying that it doesn't keep the position data and I don't know how to get rid of this problem ...

Link to comment
Share on other sites

hey Marc,

did you have another chance to look at the problem over the weekend?

I tried playing around with the sop solver to calculate the distance at sop level, but I had no luck.

Really could use another clue !

So if you could push me into the right direction I'd be very happy ;)

regards,

Manu

Link to comment
Share on other sites

ok guys, I made some progress but I'm still not satisfied with the result.

Thanks to Macha I could create a proper distance creation (but only if $FF>1, at Frame 1 the coordinates are still 0,0,0 strangely)

To make the distance test work I have to increase the substeps to 4, otherwise the collision will be not detected as the sphere moves too fast.

Can I improve the workflow yet? The simulation takes incredibly long although I'm only using low-res geometry.

Another weird thing/problem:

The Active Value Dop activates only bricks that are in either the dist_grp or the hit_grp, but when the sphere collides, the whole wall shifts and wobbles,

how is that even possible?

I've attached my latest scene and look forward to your suggestions!

cheers and good night,

Manu

Brickwall_edit_03.hipnc

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