Conditions

   6318   12   0
User Avatar
Member
113 posts
Joined: July 2005
Offline
Hi everybody,

It's now time for my daily newbie question

How would you create a condition like this ?

“IF Sphere A and Sphere B are aligned on X axis THEN create Box between them”

Should I use Vex Builder ?



Thanks in advance,
Julien
User Avatar
Member
27 posts
Joined: July 2005
Offline
Just create it.
Any trouble?
User Avatar
Member
113 posts
Joined: July 2005
Offline
Creating the box isn't such a problem

My problem is more to build the condition, I other words if sphere A and Sphere B are not aligned, do not create the box, IF aligned create the box.
User Avatar
Member
74 posts
Joined: July 2005
Offline
:idea: To create is to switch between nothing and something!

Why not use a switchOP with two inputs: something (your box) and nothing (a null sop)

Then type your expression in the “select input field”.
User Avatar
Member
113 posts
Joined: July 2005
Offline
yeah, great

That's a good philosophic answer !


Thanks 8)
User Avatar
Member
27 posts
Joined: July 2005
Offline
Sorry for my first post.
Undertaker's daily newbie question is difficult to me.
Two troubles:
I can't find null sop in SOP.
And What expression you type?
Thank you.
User Avatar
Member
113 posts
Joined: July 2005
Offline
Xiangbiao, you can find the null SOP in the “generators” section of the Tab menu .

Concerning the expression I'm trying to find an expression or a way to evaluate the difference of the centroids of the 2 objects and then use a switch, but it's not very clear to me yet, I'm wondering if I can do that kind of things with the Vex Builder …
User Avatar
Member
74 posts
Joined: July 2005
Offline
Hi again!

Try the following
Create two spheres: sphereA and sphereB.
Do the switchOP thing.
try this expression:

((centroid(“/obj/model/sphereB”,D_Z)-centroid(“/obj/model/sphereA”,D_Z))==0)&&((centroid(“/obj/model/sphereB”,D_Y)-centroid(“/obj/model/sphereA”,D_Y))==0)
warning: in this case, the null must be the first input and the box the second input.

Then change the spheres center to check the result .

Hope that helps.



Expressions get and set informations.
VEX only modify information
:idea:
User Avatar
Member
9618 posts
Joined: July 2005
Offline
The VEX Builder will only be able to process the points on geometry. Its not the right tool for the job, I'm afraid. The Null/Add SOP and Box SOP going into a Switch SOP is definitely your best interest.

type: exhelp centroid in a houdini text port for help.
jason iversen, houdini procedural pipeline supervisor @ weta digital
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
113 posts
Joined: July 2005
Offline
un peu que ça help !!

Merci bien



That works very well, thanks
User Avatar
Member
113 posts
Joined: July 2005
Offline
Ok Jason, thanks for the “methodology” tip
User Avatar
Member
27 posts
Joined: July 2005
Offline
Thank you.
In generators, couldn't find null, only find add,
I'm using 5.5, perhaps because of this.
Edited by - June 20, 2003 22:40:11
User Avatar
Member
74 posts
Joined: July 2005
Offline
Indeed. The null SOP comes with release 6!
It's also useful in sub-networks.
  • Quick Links