CharacterController issue: transform.positionWithLocalOffset assign attempt for 'Player' is not valid. positionWithLocalOffset is {NaN, NaN, NaN}
I've looked all over and seen that this issue happens when dividing by zero, which makes sense with the return of NaN.
However, I have no divisions within my script and this seemingly happen and I literally get an error as soon as I start trying to play in the editor if my XYZ values are apparently bad for some reason.
I have no idea how to solve this and I've sort of got fed up with this happening. I'd really appreciate some help if there is a work around for this.
Here is the code snippet where the issue is happening:
 private void FixedUpdate()
         {
         //Input
         bool isRunning = input.IsRunning ();
 
         float zMovement = input.ForwardMovementValue ();
         float xMovement = input.SideMovementValue ();
 
         //Calculations
         Vector3 direction = Vector3.zero;
 
         direction += transform.forward * zMovement;
         direction += transform.right * xMovement;
 
         direction.Normalize ();
 
         //Checks Sphere under player 
         RaycastHit hit;
         Physics.SphereCast (transform.position, controller.radius, Vector3.down, out hit, controller.height / 2f);
         direction = Vector3.ProjectOnPlane (direction, hit.normal).normalized;
 
         //Set scalar speed and turn it into the vector movement
         currentSpeed = (isRunning) ? runningSpeed : (direction.y > 0) ?  forwardSpeed : backSpeed;
         velocity = direction * currentSpeed;
 
         //Apply a slight push to stop falling through ground
         if (controller.isGrounded)
             velocity.y -= stickToGroundForce;
         else
             velocity += Physics.gravity;
 
         //Move
         controller.Move (velocity * Time.fixedDeltaTime);
         }
 
               For the input.forwardMovementValue etc, that's just checking for input with GetAxisRaw or Keycodes.
Currently setup for rigidbody and character controller https://i.imgur.com/wD2VL5i.png
FYI, the rigidbody is not the issue , since removing it makes no difference.
Your answer
 
             Follow this Question
Related Questions
Play animation once (when down key pressed) in c# 1 Answer
Is this true? 1 Answer
Pick up Objects using Google Daydream Controller 2 Answers
Freeze A Value 0 Answers
How to make a sound only play once whilst still in the air on a jump. 1 Answer