Jump to content
Koyemsi

Conform object to face normal

Recommended Posts

Hi.

I've designed an interior with PB. Some of my rooms have oblique walls.

I have several prefabs (paintings, posters, luminaries...) which I want to hang on these walls.

Is there any way when editing to ensure that they conform (and snap) to the surfaces ? In other words, to make sure the adopt the same orientation as the oblique walls, without having to search for the right rotation amount ?

Thanx in advance.

Share this post


Link to post
Share on other sites

Hi! Sure, you can use Polyshape for this:

image.png

When you click to place the first Polyshape point, it adopts the surface normal.

If you are using ProGrids (recommended), that point also becomes the "origin" point of a local grid for the Polyshape object, so you can keep your new shape built on a nice clean grid :)

Share this post


Link to post
Share on other sites

Thanks a lot for your quick reply.

I've been using PB for about a year, and I have to say I really love this asset. I've also installed ProGrids and PolyBrush yesterday, and just began using them ; they're great too, but I'm not totally accustomed with them.

I didn't know one could draw with Polyshape along a surface, neither did I for the locally oriented grid . These are neat features !

But what about just placing (not drawing) a ready-made prefab ? Sorry if my question seems noobish ;)

Share this post


Link to post
Share on other sites

Hi! Great to know the tools are helping :) Polybrush is still experimental, so use it with caution, ha. However, ProGrids should quickly become your #1 tool to install in every project! :)

About Polyshape: that "local grid" is only active when editing the Polyshape points. If you start editing it using vertices, edges, etc, it will snap to ProGrids "world" grid- give a test or two and that'll make sense. Just something to be aware of...and something we hope to improve, also, by way of "real" local grids :)

For placing a prefab onto a surface and using the surface normal for rotation- sorry, that's not something Unity does...yet!

Share this post


Link to post
Share on other sites

Thanx for your replies, dear admins.

ProGrids sure enters my top 5 "by default installed assets" as did ProBuilder. And PolyBrush will also certainly, when in a stable version.
Being able to work with vertices and edges using "real local grids" would be a great enhancement.

I will script something as Karl suggested, but I thought such a feature might be existing in Unity or in PB/PG.
I was hoping even for a weird combination such as Alt+Shift+Command+TripleLeftClic to do a "conform & snap". Well, maybe in a future version... ;)

Thanks again guys.

Share this post


Link to post
Share on other sites

I assume you're talking about painting with prefabs, like for Terrains ?

I tried this, and it worked in a certain way : I had to reset my clone's rotation on 2 axis, as its up vector was matching the wall's normal, and its y rotation was randomly chosen. But the third rotation value seemed to match perfectly the wall's orientation.

But there's another problem with this technique : the clone generated is no more linked to the original prefab.
So I deleted it, and placed a new prefab with the same rotation values.

Not the easiest way to proceed, but it seems to work accurately enough.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×