x


Spline Controller Camera assignments not valid

Been looking for this error but I can't seem to find much on it so hopefully someone here can help.

I am using the Hermite Spline Controller (Found Here) to allow my camera to move separately from the player while still looking at him. It seems to work fine as long as i am going forward but it seems that once i start walking backwards, the camera will follow backwards along the spline for a little while and then i get:

"transform.position assign attempt for 'Main Camera' is not valid. Input position is { NaN, NaN, NaN }. "

and

"transform.rotation assign attempt for 'Main Camera' is not valid. Input rotation is { NaN, NaN, NaN, NaN }."

I want to say it happens when i am walking back and i hit one of the nodes of the spline going backwards. I am using 5 or so cubes to set up the points of the spline and from what i can tell, nothing really changes between going forward and backward.

The code in question is below and the transform.position and transform.rotation lines are the ones that error out.

if (mState != "Stopped")
    {
       // Calculates the t param between 0 and 1
       float param = (mCurrentTime - mNodes[mCurrentIdx].Time) / (mNodes[mCurrentIdx + 1].Time - mNodes[mCurrentIdx].Time);

       // Smooth the param
       param = MathUtils.Ease(param, mNodes[mCurrentIdx].EaseIO.x, mNodes[mCurrentIdx].EaseIO.y);

       transform.position = GetHermiteInternal(mCurrentIdx, param);

       if (mRotations)
       {
         transform.rotation = GetSquad(mCurrentIdx, param);
       }
    }

I read somewhere that you want the camera to be on the LateUpdate because you want it to fire after the players position but when i switched to that, it did lots of other weird things.

more ▼

asked Feb 01 '12 at 09:12 PM

Mungoid gravatar image

Mungoid
3 3 4 5

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3000
x238

asked: Feb 01 '12 at 09:12 PM

Seen: 504 times

Last Updated: Feb 01 '12 at 09:12 PM