Question by
weraxonline · May 21, 2020 at 10:07 AM ·
gameobjectpositionaddforcevector2
My Enemies start to shoot wrong way.,Help me my enemy's dont shoot at me
I'm adding 1 enemy and start shoots at me its fine but i add 2 or more enemies my enemies starts shooting randomly. I think my character's position dont updating I'm new at Unity please help me...
public Vector2 getYon() {return (karakter.transform.position - transform.position).normalized;}
void Start()
{
dusman = GameObject.FindGameObjectWithTag("dusman").GetComponent<dusmanKontrol>();
fizik = GetComponent<Rigidbody2D>();
fizik.AddForce(dusman.getYon() * 1000);
}
Comment
Your answer
Follow this Question
Related Questions
instantiated gameobject position is not working 0 Answers
rigidbody2D addforce on x-axis 1 Answer
How to find the transform position of another gameobject then move a gameobject to that position? 1 Answer
How get position from a game object? 5 Answers
Rotat a GameObject and than shoot it in the New (x) direction 1 Answer