my problem is “this.transform.position != hedefinKonumu” not working. Because my rigidbody object not going to that exact position. going to near and rotating around.
How can i solve this?
public void GezinDolasin ()
{
if (!konumBelirlendi)
{
hedefinKonumu = new Vector3(Random.Range(-7, 7), Random.Range(-4, 4), 0); // Random.Range(-3, 3)
konumBelirlendi = true;
}
if (this.transform.position != hedefinKonumu)
{
// Hedefe Don
this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.LookRotation(hedefinKonumu - this.transform.position), donusHizi * Time.deltaTime);
// Hedefe Git
this.transform.position += this.transform.forward * hareketHizi * Time.deltaTime;
}
else
{
konumBelirlendi = false;
}
}