Custom Coordinate System

Is it possible to attach a custom coordinate system to a box mesh and then rotate the custom coordinate system with respect to world coordinate system. For example, lets say rotate the custom coordinate system along x-axis of world coordinate system. Then, whenever the vertices data of the box mesh is updated using updateVerticesData(), it should be update with respect to custom coordinate system.

Hi & welcome :slight_smile:

we have a well sorted documentation, also about transformation of coordinate systems:

Coordinate Transformation Examples | Babylon.js Documentation (babylonjs.com)

Use TransformCoordinates to Place Sphere | Babylon.js Playground (babylonjs.com)

If you don’t find what you’re looking for, don’t hesitate to ask!

2 Likes

Hi @CodingCrusader , I did view the docs you have attached, but I didn’t find what I was looking for. Please let me know if this is possible?

Is it possible to attach a custom coordinate system to a box mesh and then rotate the custom coordinate system with respect to world coordinate system. For example, lets say rotate the custom coordinate system along x-axis of world coordinate system. Then, whenever the vertices data of the box mesh is updated using updateVerticesData(), it should be update with respect to custom coordinate system.

I think most simply would be to use a TransformNode, but you wouldn’t be able to prevent automatic updates.

Another way is to store your custom rotation by Vector3, so you can rotate i.e. on x-axis and use it to apply on mesh at your wanted code line i.e. just before/after updateVertices or inside the updateVertices -function of a custom mesh.

The playground shows both alternatives:

2 Likes