Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Object isn't moving but Transform.position is falling

Discussion in 'Physics' started by danield, Jul 13, 2018.

  1. danield

    danield

    Joined:
    Sep 30, 2014
    Posts:
    40
    Hello, I'm working with NavMeshAgent characters that also have a Physics component. A raycast is cast from the transform.positon for an empty child of the enemy to the player.
    Since it seemed like there should be no possible way the raycast could see around the obstacle, I added some debug code and got this result.
    FallingNotMoving.jpg Its transform.position.y starts close to 1.25 like I would expect, but drops slowly eventually below the ground. Why is the (empty or enemy) and player transform.position slowly falling but the inspector showing no change, and what are the fixes?
     
  2. danield

    danield

    Joined:
    Sep 30, 2014
    Posts:
    40
    The transform.position of the parent object is also falling. I disabled all the scripts that move the enemy just in case that had something to do with it.
    Still happened.
    Disabled gravity - Didn't happen but no gravity wouldn't look right
    Disabled NavMeshAgent - Didn't happen but this going to be a click to move game
    So the combination of physics + navmeshagent is the culprit.

    This is the first time I have worked with NavMeshes. Any veterans have tips for avoiding this?