Okay so basically i want to check if one Vector3 is greater or equal to another vector3
Heres my script where I would like to check if transform.position is greater or equal to DesinationSpot. How would i go about doing this??
using UnityEngine;
using System.Collections;
public class RigidbodyMovePlatform : MonoBehaviour {
public Vector3 DestinationSpot;
public Vector3 OriginSpot;
public Vector3 speed = new Vector3(3, 0, 0);
public Vector3 speedBack = new Vector3(-3, 0, 0);
public bool Switch = false;
void FixedUpdate () {
//Here I wanna check if transform.position is greater than or equal to DestinationSpot
if(transform.position == DestinationSpot){
Switch = true;
}
//Here I wanna check if transform.position is less than or equal to OriginSpot
if(transform.position == OriginSpot){
Switch = false;
}
if (Switch == true) {
rigidbody.MovePosition(rigidbody.position + speedBack * Time.deltaTime);
}
else{
rigidbody.MovePosition(rigidbody.position + speed * Time.deltaTime);
}
}
}
I know others have asked simular questions but i havent been able to get a good answer atleast not one in C#.