H
H
Herman Coffman2020-05-19 16:59:54
C++ / C#
Herman Coffman, 2020-05-19 16:59:54

How to implement removal when turning on the back / side?

It is necessary that when you turn on your back and side, the enemy is removed. The code is like this:

if (transform.position.x < 50 && transform.position.x > -50 | transform.position.z < 50 && transform.position.z > -50)
{
Destroy(Me);
}

But it either doesn't work, or it doesn't work properly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2020-05-19
@MrMureno

"how do I brew a drink? I'm pouring liquid into the powder, which is in the container, but the drink is not brewed"
in fact, it turns out that you wanted to brew tea, but pour cold gasoline into cocoa powder, which is poured into a colander.
or it turns out that you are pouring water into a mug, but there is tea in a bag on the table nearby.
I hope you understand that I am trying to point out to you that the formulation of the question is terrible and with a lot of ambiguities?!
what an enemy. What do you understand by "side and back". How does it work crookedly? not always?
in the code example, there are generally positions and nothing about rotations.
my advice - try to figure it out for yourself and sensibly describe the problem - most likely the question will disappear when you start thinking about it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question