Answer the question
In order to leave comments, you need to log in
How to implement the movement of the character to the right place?
There is a character. There are 3 towers. it is necessary that by clicking on the area near the tower, the character moves to this tower. Type, the screen is divided into 3 parts and if a person presses on some part, then he throws it there. How to do it? I thought to hang the collider and catch clicks, and then move the character to the place where the click was, but I don’t know how to do it right?
Answer the question
In order to leave comments, you need to log in
RigidBody rb
void Start():
rb = get component<RighidBody>
public void тут твой метод():
if туда куда тебе нужно > posintion.x, position.y:
rb.velocity = newVector2(posintion.x, position.y - туда куда тебе нужно)
else:
rb.velocity = newVector2(posintion.x, position.y + туда куда тебе нужно)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question