No idea how to recalculate child's position after removal of the parent

Hello. I’m new at Babylon JS and need a piece of advice. I’ve been making Rubic’s cube and faced some difficulties with identifying cubies which lay in the same plane with the one you pick with your cursor, as after their rotation(I add parent for them and parent rotates) they change their position in the way I don’t understand. Here is the link: Babylon.js Playground. Thanks a lot!!!

mesh.getAbsolutePosition() gives you the world space coordinates of a mesh, would this work for you?

I tried it but it didn’t help me

Now I’m thinking of creating a plane mesh when picking the cube in order to check the collision with other cubes in the same plane and remove this plane mesh after identifying all cubes. But I suppose the solution is much more easier and this idea looks quite complicated.

An easy solution might be to keep for the duration of the game a 3 * 3 * 3 array containing all your faces.

After each rotation, you fill it back manually so you ll always have a nice representation of your cube in memory ?

Thank you, sounds good)I’m afraid I don’t completely understand how to “fill it back manually”

Did you mention to use a pivot to instead of parent?

Yes I tried but faced some difficulties in this topic, I guess I’d rather try again using pivots, thanks!

Does getAbsolutePosition help now?

1 Like

Hey John, I owe u an apology but I don’t understand what can I do with the array of indexes)))

The arrays solve the issue in your original post

John: Yeah thanks I see the cubes but not all together in the same plane after several rotations. After some first rotations it looks good but coords of some of them has been changed and when I pick the cube next time and rotate plane not all of them start moving because have other coords and I don’t know what to do.