Search Unity

Floating origin and at the same time static batch objects?

Discussion in 'Editor & General Support' started by Dark-Protocol, Dec 11, 2016.

  1. Dark-Protocol

    Dark-Protocol

    Joined:
    Nov 19, 2011
    Posts:
    279
    I'm working on an endless runner game and I'd like to take advantage of the static batching utility in order to reduce draw calls. My whole level is contained in a single root object and this object has a floating origin script which offsets all of its children when the camera (which is also a child object of the root) reaches a certain distance - standard floating origin. The problem is that once an object is combined by the static batching utility, it cannot be moved anymore so basically my floating origin is rendered useless:
    https://docs.unity3d.com/ScriptReference/StaticBatchingUtility.html

    The documentation states that if I want to move a certain object I have to move the root transform, however, that defeats the whole purpose of the floating origin because if I move the root object the player's local coordinates will eventually lose precision.

    It there a workaround for this? I don't think that putting each static object in a non-static parent that is also a child of the root, and moving the non-static parent would work.
     
  2. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052