Snapping a Vector3 to a rotated grid

Hello,
I’m trying to snap a Vector3 to a grid rotated by a Quaternion (the platform’s rotation)

Before and after:

Here is the code i’m currently using:

Thank you :slight_smile:

If you dont need to scale the gameobjects non uniformly why not just parent one to the other?

If you do then use a matrix transformation.