diff --git a/Source/Engine/Core/Math/Vector3.cs b/Source/Engine/Core/Math/Vector3.cs
index b7cc396ee..ad1797644 100644
--- a/Source/Engine/Core/Math/Vector3.cs
+++ b/Source/Engine/Core/Math/Vector3.cs
@@ -1678,12 +1678,26 @@ namespace FlaxEngine
///
///
/// out = Ceil(((A - (GridSize * 0.5f)) / GridSize) * GridSize
- public static Vector3 SnapToGrid(Vector3 Translation, float GridSize)
+ public static Vector3 SnapToGrid(Vector3 translation, float gridSize)
{
- Translation.X = Mathr.Ceil((Translation.X - (GridSize * 0.5f)) / GridSize) * GridSize;
- Translation.Y = Mathr.Ceil((Translation.Y - (GridSize * 0.5f)) / GridSize) * GridSize;
- Translation.Z = Mathr.Ceil((Translation.Z - (GridSize * 0.5f)) / GridSize) * GridSize;
- return Translation;
+ translation.X = Mathr.Ceil((translation.X - (gridSize * 0.5f)) / gridSize) * gridSize;
+ translation.Y = Mathr.Ceil((translation.Y - (gridSize * 0.5f)) / gridSize) * gridSize;
+ translation.Z = Mathr.Ceil((translation.Z - (gridSize * 0.5f)) / gridSize) * gridSize;
+ return translation;
+ }
+ ///
+ /// funcion for grid snaping snap to absolute world grid
+ ///
desined for snaping using a ray / draging object
+ ///
+ ///
+ ///
+ /// out = Ceil(((A - (GridSize * 0.5f)) / GridSize) * GridSize
+ public static Vector3 SnapToGrid(Vector3 translation, Float3 gridSize)
+ {
+ translation.X = Mathr.Ceil((translation.X - (gridSize.X * 0.5f)) / gridSize.X) * gridSize.X;
+ translation.Y = Mathr.Ceil((translation.Y - (gridSize.Y * 0.5f)) / gridSize.Y) * gridSize.Y;
+ translation.Z = Mathr.Ceil((translation.Z - (gridSize.Z * 0.5f)) / gridSize.Z) * gridSize.Z;
+ return translation;
}
///