Hi I have a simple character mesh and it's parented to my character controller-invisible-capsule object and all the moving code is applied to the parent (if that's relevant), but the point Is I'm trying to line up the mesh to be exactly inside the capsule to make it look like the player is walking ABOVE the ground (pretty normal ...?) So by default the character controller is origined in the center so I move it up by half of it's height to try to get it to line up with the character mesh, which has it's origin below it's feet a little, and this is the result: alt text

as you can clearly see, his feet slightly go into the ground, I have no idea why this is happen, then should be just above the ground like any other normal feet! Here's the code for setting the capsule up half of it's width, since it starts by lining up the mesh in it's CENTER for some reason:

Vector3 tempPos = player.transform.position;

        tempPos.y += (capsuleSize.y / 2);// + chassidSize.y / 12;
        chassid.transform.position = player.transform.position;
        player.transform.localPosition = tempPos;
        chassid.transform.parent = player.transform;

and here's a picture of the mesh (which is just a blender file, easier for import): alt text

As you can see, in the blender file, the origin is slightly below the characters feet, IN THE CENTER, so I don't know why it's not working as planned.

Also, you can see in the first picture that he's slightly moved to the center of the controller on the z(?) axis, but I want him to be completely centered in, any idea how to fix this?

  • \$\begingroup\$ Are the three Center parameters in the Character Controller inspector not adjusting the position as expected? (Also, don't forget to set your Gizmo Handle Position Toggles to "Pivot" mode so we can see where the local origin is) \$\endgroup\$ – DMGregory Aug 8 '18 at 5:01
  • \$\begingroup\$ @DMGregory I didn't set the center parameters directly I just manually moved the position of the capsule down but I tested it and it had the same effect if I adjusted the parameters also, and the gizmo should be set to pivot mode in the picture, do you want me to set it to center mode instead? \$\endgroup\$ – bluejayke Aug 8 '18 at 5:16
  • \$\begingroup\$ @DMGregory BTW I just tested it with exporting the model as an FBX and it works perfectly, looks like it's a bug with blender files? \$\endgroup\$ – bluejayke Aug 8 '18 at 19:21
  • \$\begingroup\$ Could be. I think it would be useful to future users to write up what you did to export to FBX as an Answer, so others can learn from what worked for you. \$\endgroup\$ – DMGregory Aug 8 '18 at 19:22
  • \$\begingroup\$ @DMGregory but I want it to work as a blender file also for easier importing :) \$\endgroup\$ – bluejayke Aug 8 '18 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.