#[Mesh Builder + World] Generating Procedural Mesh Weird Behaviour

4 messages · Page 1 of 1 (latest)

hardy garden
#

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 scene!

Heres my way:
1.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?

young jay
#

Hi, @hardy garden ! Maybe check a fact if triangle is in fact facing camera or an opposite direction (2 sided material might help eliminate that)

#

in that case you sould need to change the order of vertices. Also maybe there is some occludee effect caused by world mesh material?

hardy garden
#

Hey @young jay , Yes My teammates told me about two-sided at first, thats checked. I just firgured it out (maybe!). I found out that I probaby should set the whole meshVisual a posititon too! is that correct? so I calculated the center of the 3 positions with div method and set it as below.

var cnt = new vec3(0,0,0);
for(var d=0;d<bucket.length;d++){
cnt = cnt.add(bucket[d])
}
cnt = cnt.div(new vec3(bucket.length,bucket.length,bucket.length));
script.mysh.getTransform().setWorldPosition(cnt);

which didn't work!
so I kept checking it manually and i setted the whole transform of the mesh to:
script.mysh.getTransform().setWorldPosition(new vec3(0,10,0));
And I saw it on the ground 😐 , the ground which I checked and is -133Y!

Heres the result when I hit the mesh creation with 3 dots + [0,1,2] as indecis + (0,10,0) as position, from above & compared to ground.
https://ibb.co/xmP3BCz
https://ibb.co/6PV6fkP

BTW, i'm really not sure about this whole mesh position setting neither...