0
\$\begingroup\$

In my game, If i click on terrain my soldier goes there. In my terrain there is no place without a navmesh. So, I want to make area where player moves his soldiers on it. If he clicks outside this area, soldier will not move there or moves to closest point inside the area to this outside. Could invisible wall do this ? Image.Image2. update: To solve this, make any object fit your area. then, use mouse to detect that object.

\$\endgroup\$
4
  • \$\begingroup\$ What defines the shape of the area the characters are allowed to move within? Is it a circle of some radius or union of circles, a polygon or mesh thereof, a vector shape bounded by a spline, an image mask, or some other way of describing a shape? Can it change at runtime or is it fixed at build time? \$\endgroup\$
    – DMGregory
    Commented Jun 30, 2018 at 18:09
  • \$\begingroup\$ Any shape. let us take circle. and will not change through the game. I'm not sure if this will work or not. If there is any thing else better than this idea, please write it. \$\endgroup\$
    – Omer
    Commented Jun 30, 2018 at 18:52
  • 2
    \$\begingroup\$ When you found a solution yourself, then you should post an answer to your own question and accept it. That way people can see that your question was answered. People can also upvote your answer. Answering your own questions is encouraged on Stackexchange. \$\endgroup\$
    – Philipp
    Commented Jul 3, 2018 at 17:00
  • \$\begingroup\$ Sorry for that. I'm still new here. \$\endgroup\$
    – Omer
    Commented Jul 3, 2018 at 19:22

1 Answer 1

0
\$\begingroup\$

To solve this, make any object fit your area. then, use mouse to detect that object.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .