Hello, I've never been using unity before and now I decided to try making a simple 2D game. I'm trying to make hexagonal movement by one tile using mouse click but there is no progress, so I hope to get some help here. I've watched some YouTube tutorials, but I think I need something concrete to make an understanding. I was wondering if it is more simpler to make it by creating tiles as 3D objects or is there any way to make it using hexagonal grid? I hope you understood my problem.
Ok, first off you'll need to register which tile you're clicking. The Grid system has ways to easily give you cell centers based on a position: GetCellCenterWorld. If you use this and make sure that the target cell is only 1 cell away from the current cell, you can do 1 by 1 movement. Pseudo-code you place on your pawn: Code (CSharp): if(Input.GetMouseButtonDown(0)) //left mouse click { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, out RaycastHit hit) //Cast a ray from mouse pos down { Vector3 newCenter = grid.GetCellCenterWorld(hit.position); if(transform.position - newCenter <= grid.cellSize) { Move(newCenter); } } } Move(Vector3 position) { //Move to the new position, handle this however you like. }