Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Wall mounted mesh !!!  (Read 1876 times)
harikumar001
Customers
Community Member
*****
Posts: 65


« on: September 17, 2010, 06:02:48 AM »

Hey Guys,

Have a good day. Stuck with something new here. My program currently allows users to place 3d models in a room from a library and adjust its position.

Some of my models, like paintings, should be wall mounted. Previously I was stuck with the problem of correctly selecting the interior face of the selected room wall to place the mesh. With help from mithrandir i was able to select the inside facing wall of the room correctly.

My program can now mount meshes to a wall by calculating the slope of the wall and making the mesh slope equal to that of the wall and positioning the mesh on the wall. But the problem now, in some cases is that, the mesh is perfectly aligned to the wall but is on the other side, meaning the mesh is rotated by 180 degrees. I know it has something to do with how i get the rotation to be applied on the mesh from the slope. How do I correct the mesh rotation as slopes for 0 and 180 are same.

Any help will be much appreciated

Regards

Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #1 on: September 17, 2010, 11:57:44 AM »

Assuming you are using the wall normal at some point, just scale the normal by -1 for meshes you want to rotate.
Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #2 on: September 18, 2010, 12:19:53 AM »

Thank you Mithrandir for your reply  Smiley

I know i have to rotate in the direction opposite to the normal, but I am unsure to which meshes i must apply the rotation. Some meshes are placed correctly, some are rotated. So I need to find the ones that are rotated. How do I do this?
Logged
serial
Customers
Community Member
*****
Posts: 380


« Reply #3 on: September 18, 2010, 03:00:15 AM »

Does it only happen to certain meshes or all meshes placed on the same wall?
Logged
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #4 on: September 18, 2010, 04:51:49 AM »

Its not a problem with a particular mesh alone or a particular wall.

Please see the attached image to get a better idea of the problem
Logged
Mithrandir
Community Member
*
Posts: 325


« Reply #5 on: September 18, 2010, 05:06:33 PM »

Then you need to fix the wall normals. Or since some convention. I think there is something like right hand rule where you add vertices in counter clockwise direction and the normal will be created id direction of a thumb of right hand...
Logged
Lenn
Customers
Community Member
*****
Posts: 876

+/-


« Reply #6 on: September 19, 2010, 10:08:39 AM »

I think you can probably just do ComputeNormals on the wall mesh, and then do a collision ray towards the point where you want to attach the mesh, this may give you the right normal. From the TV_COLLISIONRESULT that is. Not sure tho, but you can try it.
Logged

TV3D 6.5 Community Docs - Read, use and please contribute!
harikumar001
Customers
Community Member
*****
Posts: 65


« Reply #7 on: September 20, 2010, 02:09:35 AM »

Thank you Lenn and Mithrandir

Been trying different methods to solve the problem. Lemme try what you guys suggested
Logged
Hypnotron
Customers
Community Member
*****
Posts: 1046


« Reply #8 on: September 23, 2010, 01:47:44 AM »

edit: nevermind.
« Last Edit: September 23, 2010, 01:52:47 AM by Hypnotron » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks