Jump to content

Rotation perpendicular to selected face


Recommended Posts

perpendicular is not enough for information ...

If you want the mesh2 to be perpendicular to some mesh1 face, you may tell us also how you want this mesh2 oriented ? looking at the screen ? looking at the sky ? etc

Actually you may precise 2 other more axis (the picked normal is the first one).

In your case, I would set 3 orthogonal axis (normal, Y, cross(normal, Y) if it's what you need) then I would use rotationFromAxis() to get the rotation to give to the mesh2.

Please do a PG

Link to comment
Share on other sites

I don't get what you are try to achieve ...

Imagine you just display Suzanne in its local (X,Y,Z) axis, ok ?

Now, just figure out how you want these (X, Y, Z) according to each mesh facet. "Perpendicular" is not enough information to set (X, Y, Z)

You could, for instance want :

Z => facet normal

Y => World Y ? or World Y projection on the facet normal ? or whatever ? only you know

X => cross(Y, Z)

Or anything else ... that's just an example

Link to comment
Share on other sites

16 hours ago, jerome said:

not sure,

in his last example, C75 computed a cross vector with from a mysterious axis (1, 1, 1) at the line 112 ...

Yes, that was random vector (bruted finding needful rotation), I tried to use lying mesh, and rotation formula became easier. Check it http://www.babylonjs-playground.com/#2C8LVE#6

and my final "clean" formula with standing  Suzanne  is here http://www.babylonjs-playground.com/#2C8LVE#7

But i'm still can't find solution to merge rotation of mesh and normal (@RaananW said about that). What methods I should use?

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...