For some reason player doesn’t move in the middle of the block, but stops when reaches the side of the block.
FindBlockToMove() is just a spot, but it has a child visual object with a collider. player is also just a spot and it has a child visual object. Visual objects of player and block are not touching.
Why can it happen and what should I do to make player move in the middle of the block?
And it happens both with MoveTowards and with Lerp
This is a scripting issue. Since you’re using transform.position, it’s not a physics question at all. Maybe a mod will move this thread appropriately. And next time, use the code tags to format your scripts here.
All of your code looks fine for moving at a set speed toward the destination, but you will have to call MoveToChosenBlock() on every Update() until it reaches the chosen block.
Thank you! This is my first post here, so I was a lil bit confused…
I do call this method in Update, and player moves. But it stops when it touches the side of a visual part of block and I want it to move to the block’s position which is in the middle of it’s visual part. I see, it’s hard to explain without a video
I guess it was happening because of Raycast which I was using for searching for blocks. I fixed this by separating FindBlockToMove() method from the method MoveToChosenBlock() .