V
V
Vilnar2015-11-24 09:17:57
2D
Vilnar, 2015-11-24 09:17:57

What to choose for unit control in 2D?

Good comrade.
The essence of the question is this, there is a game, for understanding let's imagine that this is an RTS, a top view, a little at an angle. Unity 2D.
I need to manage the mobs, respectively, both the player and the enemy. There are two ways to control:
1). Bundle RB + collider. In this case, the mobs will push each other if their paths cross. And they will push enemies if they go into close combat. Even if I stop them in the code in front of the enemy, then another mob may come up and push the stopped one and move the whole line. This is unacceptable. Is there a way to remove this interaction?
2). CharacterController. Mobs don't push, everything is as it should be, but.. this controller goes through two-dimensional colliders. And I would like to place static colliders in impassable places, and it’s banal that buildings cannot be passed through. CC reacts properly only to 3D colliders. The second problem is that I can't see other mobs with Physics2D.CircleCastAll(this.transform.position, 10f, new Vector2(0, 0)). And I need to find enemies around the unit in order to set a target for it to attack if the enemy is close. Do these SS restrictions really exist, or am I doing something wrong? I would not want to write a complex obstacle detection system and algorithms for avoiding them. Especially since the engine has it all.
Maybe there is another way to organize unit management in unity 2D?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question