Hi. When I place my gameobjects on top of each other they don’t get the same x coordinates even tho i they are in the exact same spots. When placed on top of each other GameObject1 get the position x=-4.3 but my GameObject2 get the position x=77.7.
Is there any way to fix this? I need this to work for this code to work:
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player") {
if (facingRight && other.transform.position.x < transform.position.x)
{
flipFacing();
}
else if (!facingRight && other.transform.position.x > transform.position.x)
{
flipFacing();
}
canFlip = false;
charging = true;
startChargeTime = Time.time + chargeTime;
}