[Mesh Builder + World] Generating Procedural Mesh Weird Behaviour

AliAkhgar
AliAkhgar Posts: 4
edited June 2023 in Programming #1

Hi everyone,
Recently I'm trying to play with mesh builder and generate some mesh!
RN, im facing a weird problem that my mesh is valid, generatable but not visible in 3d secne!

Heres my way:
first I enable worldNativePlaneTracking on Horizontal [same as WorldPlaneTracking template]
2.second, I select 3 dots on screen, convert to worldScreenSpace, and then use probe.rayCast to find my dot's worldPos on my NativePlane.
[Image1: https://ibb.co/LRf6VcD ]
[Image2: https://ibb.co/mcgLXVP ]
3.third, I kept it simple and used Mesh Builder with Triangle topology to build up mesh with this 3 dots.

Expectation:
I expect to have a single triangle mesh between these 3 dots + I made sure 3 dots are in a way in which can form a Triangle + As i first select my dots on 2d screen then convert to worldScreenSpace and then rayCast it by NativePlane, I'm pretty sure my positions are correct (compared to my NativePlane position info)

Problem:
Unforunately no mesh is being generated, or atleast seen on the desired position, although I use Triangle Topology and [0,1,2] as the Indecis!

Behaviour:
RN, I can't make it to draw a mesh based on 3 positions, but!, If i set 1 of the positions as (0,0,0) ,world 0 position, I can see a triangle formed in 3d world, in which, one vertext is (0,0,0) high in air, and 2 other vertexes are on my plain! correctly formed!
[Image3: https://ibb.co/CwkZbnB ]
[Image4: https://ibb.co/3BcRcV9 ]

Tested to manipulate Y axis on my positions, no change, no dice.

Does anyone here has any idea?

Answers

  • OK as it appears, "I had to setWorldPosition for my whole visualMesh transform to offset Y axis +0.1 units". (just enough to see mesh above NativePlane)
    I was doing the same thing on each vertices before sending over to meshBuilder.