Search Unity

Moving platforms

Discussion in 'Navigation' started by snacktime, Sep 26, 2017.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    So was thinking how to best solve this, I don't want to have two completely separate movement systems really.

    So the idea I had is you just work on offsets. So take my case where I have boats. Bake those boats into the navmesh at some out of the way location. Now to get a path on the actual moving boat, take your agent position relative to the boat, calculate the offset of that from the agent position as it would be on the static boat, and run the query. Take the query result apply the offset and you have a path on the moving boat.

    You would have to most likely update the offsets as you move the agent, to account for the boat moving.

    The last step Unity could support and make it seamless, also haven't actually tried this yet. So on the boat you have to disable the agent, but you could have a proxy agent for making queries that is on the static boat. And then you just apply the offsets to move the agent on the moving boat. If Unity let you apply an offset to the agent, this could be seamless.