Useful formulas (that arent obvious)
-
Just thought it might be an idea to post up some of the little DC/maths tricks youve found that might be useful to other people.
To start:
=sqrt((x*x)+(y*y)+(z*z))
gives the straight line distance from the model origin to the component origin.
-
Cool
-
Maybe this is obvious, but helpful for those times when you can't see the wood for the trees. You could extend that to be the distance between two points by using (A!x - B!x) in place of x (same for y and z), where A and B are the two things in question.
Obviously that would be the separation of the two axes rather than the gap between them, which would be complicated, except for special cases (like primitives).
-
It doesn't re-evaluate? I might have to look into this one when I get a chance. Thanks Remus!
Chris
-
I dont think it does...
i'll check again though, just to make sure.
-
Good one james
And another one, this time to assign an attribute a random value onclick, and doesnt reevaluate when referenced in other attributes.
set("attribute",randbetween(x,y))
Gives a random value netween x and y to attribute.
-
No, it doesnt re-evaluate, as any formula that references "attribute" just references the value instead of the randbetween formula.
p.s. I thought it was you who showed me that trick...
-
ok, so I want to create an onclick random zig-zagging line. So each line is a component inside a larger component. The first line has a random number for rotation (randbetween(-3,3). For the next line to be placed at the end of first one after the rotation I need to reference the value of the randbetween. But when I do this it reference the code instead of the value so I get a completely different number where I want the end value. I tried the set("attribute"randbetween(x,y) but I either didn't put it in the right place or it's not the right thing to do. Can someone help?
Advertisement