Hello Guest

Author Topic: Character Controllers, Tilemap, Jittery Movement.  (Read 4448 times)

HeuGamer

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Character Controllers, Tilemap, Jittery Movement.
« on: March 14, 2014, 12:24:06 am »
I have a 2d sprite with a character controller, and basically everything is using 3d colliders and such. I prefer to use this because one of my plugin doesn't support 2d colliders, and so i'm trying to work with 3d colliders on everything.

Now with the problem. I created a tilemap, it generate a boxed collider for each tile individually and created a whole mesh collider, and now here's the issue, whenever my player goes through each block it bumps downwards and then makes a jittery feel because all my blocks are connected.

Here's a webplayer(https://dl.dropboxusercontent.com/u/67760294/broken/broken.html), if you dont understand. (I wouldn't understand myself either)

As you can see when you move the player, you can't see it, but between each block the characters bumps down then back up. Im using the average character controller with the average character controller move script
Code: [Select]
CharacterController controller = GetComponent<CharacterController>();
if (controller.isGrounded) {
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, 0);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
SafeMove(controller.velocity);
}

moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);

How would I go about fixing this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Character Controllers, Tilemap, Jittery Movement.
« Reply #1 on: March 14, 2014, 10:20:49 am »
It almost looks like your tile map colliders aren't thick enough. Make them thicker in z and see if its any better.

Unity / Physx has an issue on box boundaries - it jitters and picks up a collision it shouldn't. Eg. with 2 boxes laid out next to each other, you'll have a tiny bump when you cross the middle. this shouldn't happen with the tile map stuff as its a mesh collider.

You can also smooth out small bumps in the character controller.

HeuGamer

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Character Controllers, Tilemap, Jittery Movement.
« Reply #2 on: March 15, 2014, 12:33:47 am »
Increasing the Collider Depth or Z didn't do much and what do you mean by smoothing out the small bumps in the character controller?

Here's a picture of what my colliders look like with a depth of 0.1, with 10 or 100 depth is makes no difference and it is a mesh collider.
« Last Edit: March 15, 2014, 01:20:35 am by HeuGamer »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Character Controllers, Tilemap, Jittery Movement.
« Reply #3 on: March 15, 2014, 11:12:50 am »
If you can't get it to work the way you need it to that way then you'll have to smooth out the positions to get smoother movement. 2D colliders work better, but still aren't perfect either.