Search Unity

How can I intercept changes to a transform?

Discussion in 'Scripting' started by Dirk-Gregorius, Aug 20, 2014.

  1. Dirk-Gregorius

    Dirk-Gregorius

    Joined:
    Feb 6, 2014
    Posts:
    6
    I am experimenting with some simulation software to integrate it into Unity and I need a way to intercept changes to the transform in order to update my collision proxies. This is such a basic engine feature that I am surprised it doesn't exist already. I must be missing something?
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
  3. Dirk-Gregorius

    Dirk-Gregorius

    Joined:
    Feb 6, 2014
    Posts:
    6
    I need an event when that happens.

    Say you have some kind of collision system which supports ray casts. Usually when a game object moves it would flag the associated proxy as dirty. Then when *some* game object casts a ray all dirty proxies need to be updated to be at the right location in space. You really cannot iterate all potential game objects and query the hasChanged() property for every ray.

    Actually it seems that 4.6 adds an onParentChanged() callback. I hope that Unity takes this a step further and will also add the onTransformChanged() callback.