iscometric grid panning
hi, i need move an object like in boom beach. i tried a little bit . but it's not working properly. bellow is my code .......
transform.position = SnapToGrid(curPos); Vector3 SnapToGrid(Vector3 Position) {
Vector3 gridPosition = Position;
gridPosition.x = (Mathf.Round( gridPosition.x * GridSizVal) / GridSizVal);
// gridPosition.x = (( gridPosition.x * GridSizVal) / GridSizVal);
gridPosition.z = 0;
gridPosition.y = (Mathf.Round( gridPosition.y * 4 ) )/ 4;
// gridPosition.y = (( gridPosition.y * GridSizVal ) )/ GridSizVal;
if (controller.checkEmptyPlaceList.Contains (gridPosition)) {
gridPosition = transform.position;
}
Position = gridPosition;
Position.z=0;
return Position;
}
give me an idea how i can do......... thanks for reading
Comment
Your answer
Follow this Question
Related Questions
Get angle between a position and facing direction 0 Answers
find whether the spawning space is free or not? 0 Answers
If two Vector2 are same 1 Answer
Trying to Generate Different Random Values for Position of Game Object Instances [C#] 1 Answer
How to move a 2D object toward the position it is pointing to? 0 Answers