Jump to content

Raycast points to align objects


8BitBeard

Recommended Posts

I have this nice setup. What I'm going for is a surface that I can model freely, and then apply all kinds of different objects onto it by using points that are raycast onto the surface. This way the applied objects are independent from the original object and their placement won't be messed up by changing numbers of e.g. prims on the base model. This is mostly going to be used to construct buildings with various windows, doors, etc. This is how it looks like currently:

raypoints2.gif.698f47fce5816bb35915551eaccaf9db.gif

The objects are placed by a raycast from the point onto the surface. I have checkboxes for aligning the object to the center of the primitive or moving them freely. I can also scale the objects corresponding to the primitive size.

However, I'm still having the following problem:

Scaling only works on vertically aligned primitives, as the calculation of the height and width of the primitive is very simplistic. Can anyone help me with this calculation, so it also works on angled / non-vertically aligned primitives? I know that "height / width" will mean something different, depending on which side the primitive is on. I was looking into adding in a direction that's coming from the center of the base object or even add a checkbox that allows to 'flip' the height and width (which would require to place some objects individually depending on where they are supposed to go ,which would be fine).

 

Any help on this is greatly appreciated, the .hip is attached: excercise_11_ray.hiplc

 

Link to comment
Share on other sites

Thank you very much julian. If there are simpler ways, can you point me towards a reference? I'm still learning and probably do many thing much more complicated than necessary.

The intention of this system is to have a tool that helps me build house facades much quicker. The boxes I am aligning in this example stand in for facade details such as windows, doors, ventilation objects, support beams, etc. In some instances I not only need to orient these objects towards the surface (which I already did with my first version), but also know the boundaries of the primitive they are projected on. For example a window that is always aligned at the bottom of a primitive, or a support beam that will be scaled to match the primitive size. To give some context, this is a shot of a building created with my current version of the tool:

ss_2017_06_07.png.3bdb5dca92eef000fbd604308bc3bc63.png

Link to comment
Share on other sites

I was thinking the for loops in both the main tree and the subnet were unnecessary, probably, as the copy function is effectively a for loop by itself. Anyway, take a look at the attached scene - it removes both for loops but this time it does take liberties with your original scene!

excercise_11b_ray.hipnc

excercise_11c_ray.hipnc

Edited by julian johnson
improved alignment of boxes.
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...