Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    26
    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:
    26
    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?