Help with player mis-positioning

Hello, I recently imported a character model and its been doing some quite strange stuff.


The player hovers above the ground, and when I look upon it in edit mode…

As you can see in the hierarchy I am selected the character model… however, the wire frames around an invisible and perhaps even non-existant object.

It appears that maybe some segments of the model have been dislodged and spread out? This is just a blind guess, because I am very new to Unity.

Any help is much appreciated! :slight_smile:

Your character controller is too high. Move it.

Thank you for the speedy response, precisely how do I move it? Is it in the code?

Click the player in the Hierarchy and look for the character controller. Click the drop down box that says “Center” and mess around with the x,y,z coordinates until it is centered around the player.

Ok, done. Now the green capsule surrounds my player accurately. However, I am still hovering, and look at this:

Regards!

Are you using your own script for the character or an off-the-shelf script? If it’s your own code then please can you post it?

I got it from the Wow Camera MOvement topic in Scripting…

here is Character Controller script:

private var jumpSpeed:float = 8.0;
private var gravity:float = 20.0;
private var runSpeed:float = 5.0;
private var walkSpeed:float = 1.0;
private var rotateSpeed:float = 150.0;

private var grounded:boolean = false;
private var moveDirection:Vector3 = Vector3.zero;
private var isWalking:boolean = false;
private var moveStatus:String = "idle";

function Update ()
{
   // Only allow movement and jumps while grounded
   if(grounded) {
      moveDirection = new Vector3((Input.GetMouseButton(1) ? Input.GetAxis("Horizontal") : 0),0,Input.GetAxis("Vertical"));
      
      // if moving forward and to the side at the same time, compensate for distance
      // TODO: may be better way to do this?
      if(Input.GetMouseButton(1)  Input.GetAxis("Horizontal")  Input.GetAxis("Vertical")) {
		 animation.Play("Walk");
         moveDirection *= .7;		 
      }
      
      moveDirection = transform.TransformDirection(moveDirection);
      moveDirection *= isWalking ? walkSpeed : runSpeed;
      
      moveStatus = "idle";
      if(moveDirection != Vector3.zero)
	  {
	     
		 animation.CrossFade("Walk");
         moveStatus = isWalking ? "walking" : "running";
	  }
      
      // Jump!
      if(Input.GetButton("Jump"))
         moveDirection.y = jumpSpeed;
   }
   
   // Allow turning at anytime. Keep the character facing in the same direction as the Camera if the right mouse button is down.
   if(Input.GetMouseButton(1)) {
      transform.rotation = Quaternion.Euler(0,Camera.main.transform.eulerAngles.y,0);
   } else {
      transform.Rotate(0,Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime, 0);
   }
   
   if(Input.GetMouseButton(1) || Input.GetMouseButton(0))
      Screen.lockCursor = true;
   else
      Screen.lockCursor = false;
   
   // Toggle walking/running with the T key
   if(Input.GetKeyDown("t"))
      isWalking = !isWalking;
   
   //Apply gravity
   moveDirection.y -= gravity * Time.deltaTime;
   
   //Move controller
   var controller:CharacterController = GetComponent(CharacterController);
   var flags = controller.Move(moveDirection * Time.deltaTime);
   grounded = (flags  CollisionFlags.Below) != 0;
}

@script RequireComponent(CharacterController)

Friendly bump?

…still unsolved…

What happens if you just drag the model into an empty scene? Is it positioned and oriented correctly relative to the ‘transform’ gizmo? Of is it off like in the image you posted?

WHen I drag into an empty scene, everything is aligned.