- Home /
How can I move an object to a clicked objects (center of X,Z) coordinates (board game)?
Hello,
This is my first project.
I want to make a board game (for school project ), there are 16 objects around a board, in 2 steps I want to move an objects to the board fix position. First, the player click one of the object, and the object move near to board (because need to select firstly ) and after that clicked on one of the title of the board, the selected object move to a specified tile (not exactly equal with the clicked coordinates).
My idea: I place 4x4 empty objects into the board, and when clicked on one of target object, I want to the selected object move into clicked object center position. I hope anybody understand what i want to explain with my poor English :)
I have some questions:
Is the empty object good for the target positions?
Which move type is good for this?
Which object need rigid body? I don't want the objects hitting each other on a board.
The board needs to contains object, or simply plane with texture. And empty objects on a target positions?
I need someones who made something similar. I need idea, for the right method How need to do this right?
I trying for object moving this, which works, but it is the right way?: (the speed is a public variable)
void Update()
{
Vector3 a = transform.position;
Vector3 b = GameObject.Find("Target1").transform.position;
transform.position = Vector3.MoveTowards(a, Vector3.Lerp(a, b, t), speed);
}
Thank you for your help!
Roland
Your answer
Follow this Question
Related Questions
Recalculate linerenderer when moving gameobjects 1 Answer
How to avoid instant GetMouseButtonDown-checking when instantiating object with button? 1 Answer
"Working with moving and mouse touch to set coordinates" 0 Answers
save and move to mouse click positions 1 Answer
How to make a ladder script for unitiy's FPS controller? 1 Answer