X coordinates isn't the same on my gameobjects when on same position.
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;
}
Answer by Placeholder123 · Apr 30, 2020 at 07:51 PM
Are one of the objects a child of another object? Because if an object is a child then its position will be relative to its parent
Your answer
Follow this Question
Related Questions
Player Prefs not setting the position at start of the game 0 Answers
Mixup in global and local positions? 0 Answers
i want to find object x position value at run time please help me 0 Answers
How to Move a GameObject to a fixed position 1 Answer
How do you thrust an object to another object's position? 0 Answers