Weird behaviour while rotating intersection (manually calculating Inverse Kinematics)

This is my playground: https://playground.babylonjs.com/#D25VJD#14

When I rotate the vertical wall around its vertical axis, intersection does not rotate:

When I rotate around Z, thins get even weirder…

image

What’s going on here?!?

Passing true for the absolute parameter of CSG.FromMesh works:

1 Like

Cool thanks.
Now more difficult :wink:

If you drag the flat gizmo, script will calculate this intersection:

image

The white line should go from gizmo to that intersection… but I always get 0,0,0 as its position, why?!? I tried with the “true” you suggestes, no luck.

Relevant lines are 384-411.

Your PG is getting a little too complicated… Are you able to reduce it to the bare minimum to show the problem?

1 Like

As I said, the problem is in lines 384-411, where I try to figure out which are the coordinates of the final section.

I intersect a circle with a sphere, obtaining two objects, which actually are seen like one single mesh by Babylon;
so I subtract the “upper part of the world” from this mesh, thus obtaining only the intersection under the horizontal plane;
but this single small mesh keeps having (0,0,0) as coordinates, regardless of any matrix update I do.

image

Ok, simplified PG:

How do I get actual position of the intersection?!? I get always 0.

I found the solution but… should this be considered a bug? The intersection position is always 0,0,0, but the center of its bounding box changes properly:

It’s not a bug, it’s because the CSG mesh is not centered relative to its local coordinate system (local (0,0,0) is not the center of the bounding box) when it is created.

1 Like