Transform.InverseTransformPoint is all jiggy. Bug?

Hello there.

I’m trying to do a simple turret script, pointing my object toward another one on only one axis, and for this, I’m using Transform.InverseTransformPoint to get a localized position of my target.

The problem is when I use this function, the result position is all jiggy one frame after another.

An example script could be this :

using UnityEngine;
using System.Collections;

public class TurretControl : MonoBehaviour {
    public Transform target;

    // Update is called once per frame
    void Update () {
        Vector3 localizedPosition = transform.InverseTransformPoint(target.transform.position);
        Debug.Log (string.Format ("Frame = {0}, position = {1}", Time.frameCount, localizedPosition));
    }
}

The target object don’t move a bit, and the logs gives me this :

So… Bug?

There’s no bug with InverseTransformPoint, if that’s what you’re asking. None of the basic math functions have bugs.

–Eric

Erh, nevermind. Should have posted the entire script. And I shouldn’t code after a white night.